git add -A
stages all changes
git add .
stages new files and modifications, without deletions (on the current directory and its subdirectories).
git add -u
stages modifications and deletions, without new files
Detail:
The important point about git add .
is that it looks at the working tree and adds all those paths to the staged changes if they are either changed or are new and not ignored, it does not stage any 'rm' actions.
git add -u
looks at all the already tracked files and stages the changes to those files if they are different or if they have been removed. It does not add any new files, it only stages changes to already tracked files.
git add -A
or git add --all
is a handy shortcut for doing both of those. This adds, modifies, and removes index entries to match the working tree.