All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/3] checkout.txt: document a common case that ignores ambiguation rules
Date: Wed,  7 Sep 2016 18:19:40 +0700	[thread overview]
Message-ID: <20160907111941.2342-3-pclouds@gmail.com> (raw)
In-Reply-To: <20160907111941.2342-1-pclouds@gmail.com>

Normally we err on the safe side: if something can be seen as both an
SHA1 and a pathspec, we stop and scream. In checkout, there is one
exception added in 859fdab (git-checkout: improve error messages, detect
ambiguities. - 2008-07-23), to allow the common case "git checkout
branch". Let's document this exception.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/git-checkout.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 7a2201b..94eb238 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -419,6 +419,15 @@ $ git reflog -2 HEAD # or
 $ git log -g -2 HEAD
 ------------
 
+ARGUMENT AMBIGUATION
+--------------------
+
+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.
+
 EXAMPLES
 --------
 
-- 
2.8.2.524.g6ff3d78


  parent reply	other threads:[~2016-09-07 11: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   ` Nguyễn Thái Ngọc Duy [this message]
2016-09-08 20:03     ` [PATCH 2/3] checkout.txt: document a common case that ignores ambiguation rules Junio C Hamano
2016-09-09 19:21       ` Junio C Hamano
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=20160907111941.2342-3-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.