summaryrefslogtreecommitdiff
path: root/Documentation/git-add.txt
diff options
context:
space:
mode:
authorLibravatar Matthieu Moy <Matthieu.Moy@imag.fr>2013-01-28 10:16:33 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-01-28 10:31:35 -0800
commit0fa2eb530fb748774c5b2f309a471cf048b8d9d9 (patch)
treeb40c4546d4513d0f56fd3c0ea1b04c7692b0fa67 /Documentation/git-add.txt
parentgit-for-each-ref.txt: 'raw' is a supported date format (diff)
downloadtgif-0fa2eb530fb748774c5b2f309a471cf048b8d9d9.tar.xz
add: warn when -u or -A is used without pathspec
Most Git commands that can be used with or without pathspec operate tree-wide by default, the pathspec being used to restrict their scope. A few exceptions are: 'git grep', 'git clean', 'git add -u' and 'git add -A'. When run in a subdirectory without pathspec, they operate only on paths in the current directory. The inconsistency of 'git add -u' and 'git add -A' is particularly problematic since other 'git add' subcommands (namely 'git add -p' and 'git add -e') are tree-wide by default. It also means that "git add -u && git commit" will record a state that is different from what is recorded with "git commit -a". Flipping the default now is unacceptable, so let's start training users to type 'git add -u|-A :/' or 'git add -u|-A .' explicitly, to prepare for the next steps: * forbid 'git add -u|-A' without pathspec (like 'git add' without option) * much later, maybe, re-allow 'git add -u|-A' without pathspec, that will add all tracked and modified files, or all files, tree-wide. A nice side effect of this patch is that it makes the :/ magic pathspec easier to discover for users. When the command is called from the root of the tree, there is no ambiguity and no need to change the behavior, hence no need to warn. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-add.txt')
-rw-r--r--Documentation/git-add.txt7
1 files changed, 4 insertions, 3 deletions
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index fd9e36b99f..533355984c 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -107,9 +107,10 @@ apply to the index. See EDITING PATCHES below.
from the index if the corresponding files in the working tree
have been removed.
+
-If no <filepattern> is given, default to "."; in other words,
-update all tracked files in the current directory and its
-subdirectories.
+If no <filepattern> 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 <filepattern> should not be used.
-A::
--all::