From: Dannier Castro L <danniercl@gmail.com>
To: git@vger.kernel.org
Cc: Dannier Castro L <danniercl@gmail.com>,
gitster@pobox.com, Matthieu.Moy@imag.fr, jrnieder@gmail.com,
bmwill@google.com
Subject: [PATCH 3/3] doc: update doc for strict usage of -- checkout
Date: Sat, 12 May 2018 20:23:34 -0600 [thread overview]
Message-ID: <1526178214-30956-3-git-send-email-danniercl@gmail.com> (raw)
In-Reply-To: <1526178214-30956-1-git-send-email-danniercl@gmail.com>
The flag '--' must always be before any file path when <checkout>
command is used.
The main documentation about the usage of <checkout> command is
updated to include the strict usage of the flag '--' so that the
user can specify file names over branch names.
Signed-off-by: Dannier Castro L <danniercl@gmail.com>:
---
Documentation/git-checkout.txt | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index ca5fc9c..8360a98 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -12,9 +12,9 @@ SYNOPSIS
'git checkout' [-q] [-f] [-m] --detach [<branch>]
'git checkout' [-q] [-f] [-m] [--detach] <commit>
'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
-'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
-'git checkout' [<tree-ish>] [--] <pathspec>...
-'git checkout' (-p|--patch) [<tree-ish>] [--] [<paths>...]
+'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] -- <paths>...
+'git checkout' [<tree-ish>] -- <pathspec>...
+'git checkout' (-p|--patch) [<tree-ish>] [-- <paths>...]
DESCRIPTION
-----------
@@ -79,7 +79,7 @@ be used to detach HEAD at the tip of the branch (`git checkout
+
Omitting <branch> detaches HEAD at the tip of the current branch.
-'git checkout' [<tree-ish>] [--] <pathspec>...::
+'git checkout' [<tree-ish>] -- <pathspec>...::
Overwrite paths in the working tree by replacing with the
contents in the index or in the <tree-ish> (most often a
@@ -95,7 +95,7 @@ specific side of the merge can be checked out of the index by
using `--ours` or `--theirs`. With `-m`, changes made to the working tree
file can be discarded to re-create the original conflicted merge result.
-'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]::
+'git checkout' (-p|--patch) [<tree-ish>] [-- <pathspec>...]::
This is similar to the "check out paths to the working tree
from either the index or from a tree-ish" mode described
above, but lets you use the interactive interface to show
@@ -453,7 +453,7 @@ mistake, and gets it back from the index.
$ git checkout master <1>
$ git checkout master~2 Makefile <2>
$ rm -f hello.c
-$ git checkout hello.c <3>
+$ git checkout -- hello.c <3>
------------
+
<1> switch branch
@@ -471,14 +471,6 @@ Note the quotes around `*.c`. The file `hello.c` will also be
checked out, even though it is no longer in the working tree,
because the file globbing is used to match entries in the index
(not in the working tree by the shell).
-+
-If you have an unfortunate branch that is named `hello.c`, this
-step would be confused as an instruction to switch to that branch.
-You should instead write:
-+
-------------
-$ git checkout -- hello.c
-------------
. After working in the wrong branch, switching to the correct
branch would be done using:
--
2.7.4
next prev parent reply other threads:[~2018-05-13 2:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-13 2:23 [PATCH 1/3] checkout.c: add strict usage of -- before file_path Dannier Castro L
2018-05-13 2:23 ` [PATCH 2/3] test: update tests for strict usage of -- checkout Dannier Castro L
2018-05-13 2:23 ` Dannier Castro L [this message]
2018-05-13 6:03 ` [PATCH 1/3] checkout.c: add strict usage of -- before file_path Duy Nguyen
2018-05-13 19:11 ` Dannier Castro L
2018-05-13 20:18 ` SZEDER Gábor
2018-05-13 23:06 ` Philip Oakley
2018-05-14 1:51 ` Junio C Hamano
2018-05-13 21:02 ` Kevin Daudt
2018-05-14 14:52 ` Duy Nguyen
2018-05-14 15:43 ` Duy Nguyen
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=1526178214-30956-3-git-send-email-danniercl@gmail.com \
--to=danniercl@gmail.com \
--cc=Matthieu.Moy@imag.fr \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).