0

At the time I get the status, it prints like this in the console.

$ git status
On branch easy_buy_and_sell
Your branch is up-to-date with 'origin/easy_buy_and_sell'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:  xyz/src/main/java/com/draglet/domain/order/LocalOrderImpl.java

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        log/
        production/

no changes added to commit (use "git add" and/or "git commit -a")

Now, when I execute the git add ., it staged all the files in the log/ and the production/ folders. What can I do for not staging the untracked files?

Arefe
  • 11,321
  • 18
  • 114
  • 168

1 Answers1

1

Instead of using git add . use git add draglet-common/src/main/java/com/draglet/domain/order/LocalOrderImpl.java

Because git add . stages all the files in working directory.

You can stage individual files by using git add path/to/file1 path/to/file2

You can use git add -u path/to/file1 path/to/file2 to stage modified and deleted files.

harish chava
  • 252
  • 2
  • 19
  • How can you stage a deleted file if this not in the workspace anymore? – Arefe Mar 29 '18 at 11:27
  • After deleting a file, If you do `git status` then it shows the file was deleted. Now if you do `git add deleted/file` It means that this file won't present in staging area . Now if you commit it then the file wont be there in your commit. – harish chava Mar 29 '18 at 11:35