aboutsummaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-09-29 16:49:43 -0700
committerJunio C Hamano <gitster@pobox.com>2016-09-29 16:49:44 -0700
commitd336b675680c7d4adc9f7190b7974b2ef10c0af4 (patch)
treef27b45c24a78fecac73f6bf5407d9450052ab8aa /Documentation
parent710658413712fd4c4abe539d4788aa954a36734a (diff)
parentb829b9439adc12fa4fb33338694e7f1ad40254c1 (diff)
downloadgit-d336b675680c7d4adc9f7190b7974b2ef10c0af4.tar.gz
git-d336b675680c7d4adc9f7190b7974b2ef10c0af4.tar.xz
Merge branch 'nd/checkout-disambiguation' into maint
"git checkout <word>" does not follow the usual disambiguation rules when the <word> can be both a rev and a path, to allow checking out a branch 'foo' in a project that happens to have a file 'foo' in the working tree without having to disambiguate. This was poorly documented and the check was incorrect when the command was run from a subdirectory. * nd/checkout-disambiguation: checkout: fix ambiguity check in subdir checkout.txt: document a common case that ignores ambiguation rules checkout: add some spaces between code and comment
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-checkout.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 7a2201b05..8e2c0662d 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -419,6 +419,18 @@ $ git reflog -2 HEAD # or
$ git log -g -2 HEAD
------------
+ARGUMENT DISAMBIGUATION
+-----------------------
+
+When there is only one argument given and it is not `--` (e.g. "git
+checkout abc"), and when the argument is both a valid `<tree-ish>`
+(e.g. a branch "abc" exists) and a valid `<pathspec>` (e.g. a file
+or a directory whose name is "abc" exists), Git would usually ask
+you to disambiguate. Because checking out a branch is so common an
+operation, however, "git checkout abc" takes "abc" as a `<tree-ish>`
+in such a situation. Use `git checkout -- <pathspec>` if you want
+to checkout these paths out of the index.
+
EXAMPLES
--------