git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] add: Clarify documentation of -A and -u

From
Greg Price <price@mit.edu>
Date
Mar 6, 2013, 07:26 UTC
Message-ID
<20130306072610.GB15534@biohazard-cafe.mit.edu>

The documentation of '-A' is very confusing for someone who doesn't already know what it does. In particular, it describes the option's meaning by reference to that of '-u', but it's no more similar to the latter than it is to the default behavior. Describe it directly (and in a way that uses the word 'all'), and then describe the contrast separately.

Signed-off-by: Greg Price <price@mit.edu>
---
 Documentation/git-add.txt | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 388a225..f89d920 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -105,7 +105,9 @@ apply to the index. See EDITING PATCHES below.
 	will never stage new files, but that it will stage modified
 	new contents of tracked files and that it will remove files
 	from the index if the corresponding files in the working tree
-	have been removed.
+	have been removed.  By contrast `-A` will add new files as
+	well as updating and removing existing ones, and the default
+	behavior will add new files and will not remove existing ones.
 +
 If no <pathspec> is given, the current version of Git defaults to
 "."; in other words, update all tracked files in the current directory
@@ -114,10 +116,17 @@ of Git, hence the form without <pathspec> should not be used.
 
 -A::
 --all::
-	Like `-u`, but match <pathspec> against files in the
-	working tree in addition to the index. That means that it
-	will find new files as well as staging modified content and
-	removing files that are no longer in the working tree.
+	Update the index regarding all files that match <pathspec>,
+	either in the index or the working tree.  That is, remove
+	files that are only in the index, add files that are only in
+	the working tree, and update files that differ between the
+	two.  By contrast `-u` only removes and updates, and the
+	default behavior only adds and updates.
++
+If no <pathspec> is given, the current version of Git defaults to
+"."; in other words, update all tracked files in the current directory
+and its subdirectories. This default will change in a future version
+of Git, hence the form without <pathspec> should not be used.
 
 -N::
 --intent-to-add::
-- 
1.7.11.3
Next: Junio C Hamano
Message 1 of 4 in “add: Clarify documentation of -A and -u”
  1. add: Clarify documentation of -A and -uGreg Price, Mar 6, 2013
  2. Junio C HamanoMar 6, 2013
  3. Greg PriceMar 7, 2013
  4. Junio C HamanoMar 7, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.