git add .
will add new and modified files to the index. git add -u
will delete files from the index when they are deleted on-disk and update modified files, but will not add new files. You need a combination of the two:
git add . && git add -u .
Addendum: It appears that the -A
switch will catch all three: added, modified, and deleted files.
git add -A .
Note the extra ‘.’ on git add -A
and git add -u
Warning, starting git 2.0 (mid 2013), git add -A|u
(not extra dot) will always stage files on the all working tree.
If you want to stage file only under your current path with that working tree, then you need to use
$ git add -A .
See “Difference of “git add -A
” and “git add .
””.