I was assuming that both work in the same way. Both add every file onto index. But I seem wrong.
- What's the difference between
git add .
andgit add -u
?
I was assuming that both work in the same way. Both add every file onto index. But I seem wrong.
git add .
and git add -u
?
Like the manual says:
git add .
will add all files in you current directory, whilegit add -u .
will only add those already being tracked.git add documentaiton
add all files from the current directory
only update files currently being tracked.
It is one of the git gotchas mentioned here (pre Git 2.0).
git add .
only adds what is there, not what has been deleted (if tracked).git add -A
would take care of both steps...With Git 2.0,
git add -A
is default.Warning (git1.8.3 April 2013, for upcoming git2.0).
I have modified my answer to say
git add -u .
, instead ofgit add -u
.:As I mentioned in "e"