diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-04-19 12:18:20 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-08 23:26:56 -0800 |
commit | 45c45e300bcbe493a39533bb04f6bd548e8a3f19 (patch) | |
tree | 5ac08e2d6af81dcbd3c57efdc49e63612bd12640 /Documentation/git-add.txt | |
parent | 300c0a2209b753da1075770f7b696b1814c010f7 (diff) | |
download | git-45c45e300bcbe493a39533bb04f6bd548e8a3f19.tar.gz |
git add: start preparing for "git add <pathspec>..." to default to "-A"
When "git add subdir/" is run without "-u" or "-A" option, e.g.
$ edit subdir/x
$ create subdir/y
$ rm subdir/z
$ git add subdir/
the command does not notice removal of paths (e.g. subdir/z) from
the working tree. This sometimes confuses new people, as arguably
"git add" is told to record the current state of "subdir/" as a
whole, not the current state of the paths that exist in the working
tree that matches that pathspec (the latter by definition excludes
the state of "subdir/z" because it does not exist in the working
tree).
Plan to eventually make "git add" pretend as if "-A" is given when
there is a pathspec on the command line. When resolving a conflict
to remove a path, the current code tells you to "git rm $path", but
with such a change, you will be able to say "git add $path" (of
course you can do "git add -A $path" today). That means that we can
simplify the advice messages given by "git status". That all will
be in Git 2.0 or later, if we are going to do so.
For that transition to work, people need to learn either to say "git
add --no-all subdir/" when they want to ignore the removed paths
like "subdir/z", or to say "git add -A subdir/" when they want to
take the state of the directory as a whole.
"git add" without any argument will continue to be a no-op.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-add.txt')
-rw-r--r-- | Documentation/git-add.txt | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index b0944e57d5..5c501a299e 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'git add' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p] - [--edit | -e] [--all | [--update | -u]] [--intent-to-add | -N] + [--edit | -e] [--[no-]all | [--update | -u]] [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--] [<pathspec>...] @@ -121,6 +121,18 @@ If no <pathspec> is given, the current version of Git defaults to and its subdirectories. This default will change in a future version of Git, hence the form without <pathspec> should not be used. +--no-all:: + Update the index by adding new files that are unknown to the + index and files modified in the working tree, but ignore + files that have been removed from the working tree. This + option is a no-op when no <pathspec> is used. ++ +This option is primarily to help the current users of Git, whose +"git add <pathspec>..." ignores removed files. In future versions +of Git, "git add <pathspec>..." will be a synonym to "git add -A +<pathspec>..." and "git add --no-all <pathspec>..." will behave like +today's "git add <pathspec>...", ignoring removed files. + -N:: --intent-to-add:: Record only the fact that the path will be added later. An entry |