Skip to content

Commit 5cae935

Browse files
gnpricegitster
authored andcommitted
add: Clarify documentation of -A and -u
The documentation of '-A' and '-u' is very confusing for someone who doesn't already know what they do. Describe them with fewer words and clearer parallelism to each other and to the behavior of plain 'add'. Also mention the default <pathspec> for '-A' as well as '-u', because it applies to both. Signed-off-by: Greg Price <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7799588 commit 5cae935

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Documentation/git-add.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,9 @@ apply to the index. See EDITING PATCHES below.
100100

101101
-u::
102102
--update::
103-
Only match <pathspec> against already tracked files in
104-
the index rather than the working tree. That means that it
105-
will never stage new files, but that it will stage modified
106-
new contents of tracked files and that it will remove files
107-
from the index if the corresponding files in the working tree
108-
have been removed.
103+
Update the index just where it already has an entry matching
104+
<pathspec>. This removes as well as modifies index entries to
105+
match the working tree, but adds no new files.
109106
+
110107
If no <pathspec> is given, the current version of Git defaults to
111108
"."; in other words, update all tracked files in the current directory
@@ -114,10 +111,15 @@ of Git, hence the form without <pathspec> should not be used.
114111

115112
-A::
116113
--all::
117-
Like `-u`, but match <pathspec> against files in the
118-
working tree in addition to the index. That means that it
119-
will find new files as well as staging modified content and
120-
removing files that are no longer in the working tree.
114+
Update the index not only where the working tree has a file
115+
matching <pathspec> but also where the index already has an
116+
entry. This adds, modifies, and removes index entries to
117+
match the working tree.
118+
+
119+
If no <pathspec> is given, the current version of Git defaults to
120+
"."; in other words, update all files in the current directory
121+
and its subdirectories. This default will change in a future version
122+
of Git, hence the form without <pathspec> should not be used.
121123

122124
-N::
123125
--intent-to-add::

0 commit comments

Comments
 (0)