summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-10-17 15:55:08 -0700
committerJunio C Hamano <gitster@pobox.com>2013-10-17 15:55:08 -0700
commitff6e1b887f6f038b7e8d7aaea2ca19d9add03607 (patch)
treed7fe4b395fac392a6c48f89077268fa144ca74f3
parent83f18cdd71d9154c9b563d13c502dd475b3ac88c (diff)
parent26776c9737a6b5b0e7aab142aef6ba856d8b46ca (diff)
downloadgit-ff6e1b887f6f038b7e8d7aaea2ca19d9add03607.tar.gz
Merge branch 'jc/checkout-detach-doc'
"git checkout [--detach] <commit>" was listed poorly in the synopsis section of its documentation. * jc/checkout-detach-doc: checkout: update synopsys and documentation on detaching HEAD
-rw-r--r--Documentation/git-checkout.txt14
1 files changed, 8 insertions, 6 deletions
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index ca118ac6bf..91294f89c8 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -9,7 +9,8 @@ SYNOPSIS
--------
[verse]
'git checkout' [-q] [-f] [-m] [<branch>]
-'git checkout' [-q] [-f] [-m] [--detach] [<commit>]
+'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' [-p|--patch] [<tree-ish>] [--] [<paths>...]
@@ -62,7 +63,7 @@ that is to say, the branch is not reset/created unless "git checkout" is
successful.
'git checkout' --detach [<branch>]::
-'git checkout' <commit>::
+'git checkout' [--detach] <commit>::
Prepare to work on top of <commit>, by detaching HEAD at it
(see "DETACHED HEAD" section), and updating the index and the
@@ -71,10 +72,11 @@ successful.
tree will be the state recorded in the commit plus the local
modifications.
+
-Passing `--detach` forces this behavior in the case of a <branch> (without
-the option, giving a branch name to the command would check out the branch,
-instead of detaching HEAD at it), or the current commit,
-if no <branch> is specified.
+When the <commit> argument is a branch name, the `--detach` option can
+be used to detach HEAD at the tip of the branch (`git checkout
+<branch>` would check out that branch without detaching HEAD).
++
+Omitting <branch> detaches HEAD at the tip of the current branch.
'git checkout' [-p|--patch] [<tree-ish>] [--] <pathspec>...::