From: Jonathan Nieder <jrnieder@gmail.com>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>, Tomas Carnecky <tom@dbservice.com>
Subject: [PATCH] Documentation/checkout: clarify description
Date: Sun, 30 May 2010 03:41:53 -0500 [thread overview]
Message-ID: <20100530084153.GA5447@progeny.tock> (raw)
To the first-time reader, it may not be obvious that ‘git checkout’
has two modes, nor that if no branch is specified it will read
from the index.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Thanks to neha_ from IRC for pointing this out.
Documentation/git-checkout.txt | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 4505eb6..99bd7f2 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -15,26 +15,32 @@ SYNOPSIS
DESCRIPTION
-----------
+Retrieves files from the index or specified tree and writes them
+to the working tree.
-When <paths> are not given, this command switches branches by
-updating the index, working tree, and HEAD to reflect the specified
-branch.
+'git checkout' [-b <new branch>] [<branch>]::
+ When <paths> are not given, this command switches branches by
+ updating the index, working tree, and HEAD to reflect the
+ specified branch.
++
If `-b` is given, a new branch is created and checked out, as if
linkgit:git-branch[1] were called; in this case you can
use the --track or --no-track options, which will be passed to `git
branch`. As a convenience, --track without `-b` implies branch
creation; see the description of --track below.
-When <paths> or --patch are given, this command does *not* switch
-branches. It updates the named paths in the working tree from
-the index file, or from a named <tree-ish> (most often a commit). In
-this case, the `-b` and `--track` options are meaningless and giving
-either of them results in an error. The <tree-ish> argument can be
-used to specify a specific tree-ish (i.e. commit, tag or tree)
-to update the index for the given paths before updating the
-working tree.
+'git checkout' [--patch] [<tree-ish>] [--] [<pathspec>...]::
+ When <paths> or --patch are given, this command does *not* switch
+ branches. It updates the named paths in the working tree from
+ the index file, or from a named <tree-ish> (most often a commit). In
+ this case, the `-b` and `--track` options are meaningless and giving
+ either of them results in an error. The <tree-ish> argument can be
+ used to specify a specific tree-ish (i.e. commit, tag or tree)
+ to update the index for the given paths before updating the
+ working tree.
++
The index may contain unmerged entries after a failed merge. By
default, if you try to check out such an entry from the index, the
checkout operation will fail and nothing will be checked out.
--
1.7.1
next reply other threads:[~2010-05-30 8:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-30 8:41 Jonathan Nieder [this message]
2010-06-01 6:10 ` [PATCH] Documentation/checkout: clarify description Jeff King
2010-06-01 7:25 ` Jonathan Nieder
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=20100530084153.GA5447@progeny.tock \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=tom@dbservice.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).