Reputation: 26335
According to the git documentation:
-A
--all
--no-ignore-removalUpdate the index not only where the working tree has a file matching
<pathspec>
but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree.If no
<pathspec>
is given when -A option is used, all files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).
I understood this to mean that when I run git add -A subdirectory
, that git effectively is doing this:
$ git update-index --again
$ git add subdirectory
However, upon doing a simple test in a local dummy git repository, it does not update files that are outside of <pathspec>
but also have been staged. In fact, I can't find any difference in behavior with or without the -A
option.
Can anyone explain the behavior of the -A
option for git add
(the git documentation's explanations are always a bit bitter to swallow)?
Upvotes: 1
Views: 95
Reputation: 1253
The --no-ignore-removal
is a clue. It means that if a file does not appear in your working tree but does appear in the index - e.g. if you have rm
ed it but not git rm
ed it - then it will be removed from the index (as if you had git rm
ed it).
Upvotes: 3