From: Junio C Hamano <gitster@pobox•com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 2/3] checkout.txt: document a common case that ignores ambiguation rules
Date: Fri, 09 Sep 2016 12:21:02 -0700 [thread overview]
Message-ID: <xmqqfup8c21t.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqq7famgnwo.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Thu, 08 Sep 2016 13:03:03 -0700")
I'll queue the following as "fixup!" for now. It reminds me that
the title also needs rewording; we do not have rules to make things
ambiguous ;-)
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 46b04b1..8e2c066 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -419,14 +419,17 @@ $ git reflog -2 HEAD # or
$ git log -g -2 HEAD
------------
-ARGUMENT AMBIGUATION
---------------------
+ARGUMENT DISAMBIGUATION
+-----------------------
When there is only one argument given and it is not `--` (e.g. "git
-checkout abc"), "abc" could be seen as either a `<tree-ish>` or a
-`<pathspec>`, but Git will assume the argument is a `<tree-ish>`, which is
-a common case for switching branches. Use `git checkout -- <pathspec>`
-form if you mean it to be a pathspec.
+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
--------
--
2.10.0-339-gc0c747f
next prev parent reply other threads:[~2016-09-09 19:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-22 12:35 [PATCH] checkout: swap the order of ambiguity check for :/ syntax Nguyễn Thái Ngọc Duy
2016-08-24 16:35 ` Junio C Hamano
2016-08-25 9:21 ` Duy Nguyen
2016-08-25 17:19 ` Junio C Hamano
2016-08-26 13:34 ` Duy Nguyen
2016-09-07 11:19 ` [PATCH 0/3] fix checkout ambiguation in subdir Nguyễn Thái Ngọc Duy
2016-09-07 11:19 ` [PATCH 1/3] checkout: add some spaces between code and comment Nguyễn Thái Ngọc Duy
2016-09-07 11:19 ` [PATCH 2/3] checkout.txt: document a common case that ignores ambiguation rules Nguyễn Thái Ngọc Duy
2016-09-08 20:03 ` Junio C Hamano
2016-09-09 19:21 ` Junio C Hamano [this message]
2016-09-07 11:19 ` [PATCH 3/3] checkout: fix ambiguity check in subdir Nguyễn Thái Ngọc Duy
2016-09-08 20:04 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfup8c21t.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=pclouds@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox