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
This commit is contained in:
Junio C Hamano 2013-10-17 15:55:08 -07:00
commit ff6e1b887f

View file

@ -9,7 +9,8 @@ SYNOPSIS
-------- --------
[verse] [verse]
'git checkout' [-q] [-f] [-m] [<branch>] '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' [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>... 'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
'git checkout' [-p|--patch] [<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. successful.
'git checkout' --detach [<branch>]:: 'git checkout' --detach [<branch>]::
'git checkout' <commit>:: 'git checkout' [--detach] <commit>::
Prepare to work on top of <commit>, by detaching HEAD at it Prepare to work on top of <commit>, by detaching HEAD at it
(see "DETACHED HEAD" section), and updating the index and the (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 tree will be the state recorded in the commit plus the local
modifications. modifications.
+ +
Passing `--detach` forces this behavior in the case of a <branch> (without When the <commit> argument is a branch name, the `--detach` option can
the option, giving a branch name to the command would check out the branch, be used to detach HEAD at the tip of the branch (`git checkout
instead of detaching HEAD at it), or the current commit, <branch>` would check out that branch without detaching HEAD).
if no <branch> is specified. +
Omitting <branch> detaches HEAD at the tip of the current branch.
'git checkout' [-p|--patch] [<tree-ish>] [--] <pathspec>...:: 'git checkout' [-p|--patch] [<tree-ish>] [--] <pathspec>...::