Browse Source

doc/checkout: split checkout and branch creation in synopsis

These can really be thought of as two different modes, since
the "<branch>" parameter is treated differently in the two
(in one it is the branch to be checked out, but in the other
it is really a start-point for branch creation).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jeff King 16 years ago committed by Junio C Hamano
parent
commit
76cfadfc17
  1. 40
      Documentation/git-checkout.txt

40
Documentation/git-checkout.txt

@ -8,23 +8,22 @@ git-checkout - Checkout a branch or paths to the working tree
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git checkout' [-q] [-f] [-m] [-b <new_branch>] [<branch>] 'git checkout' [-q] [-f] [-m] [<branch>]
'git checkout' [-q] [-f] [-m] [-b <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>...


DESCRIPTION DESCRIPTION
----------- -----------


When <paths> are not given, this command switches branches by When <paths> are not given, this command switches branches by
updating the index and working tree to reflect the specified updating the index, working tree, and HEAD to reflect the specified
branch, <branch>, and updating HEAD to be <branch> or, if branch.
specified, <new_branch>. Using -b will cause <new_branch> to
be created 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 will default to creating a branch whose If `-b` is given, a new branch is created and checked out, as if
name is constructed from the specified branch name by stripping linkgit:git-branch[1] were called; in this case you can
the first namespace level. 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> are given, this command does *not* switch When <paths> are given, this command does *not* switch
branches. It updates the named paths in the working tree from branches. It updates the named paths in the working tree from
@ -63,7 +62,7 @@ entries; instead, unmerged entries are ignored.


-b:: -b::
Create a new branch named <new_branch> and start it at Create a new branch named <new_branch> and start it at
<branch>; see linkgit:git-branch[1] for details. <start_point>; see linkgit:git-branch[1] for details.


-t:: -t::
--track:: --track::
@ -114,13 +113,6 @@ the conflicted merge in the specified paths.
"merge" (default) and "diff3" (in addition to what is shown by "merge" (default) and "diff3" (in addition to what is shown by
"merge" style, shows the original contents). "merge" style, shows the original contents).


<new_branch>::
Name for the new branch.

<tree-ish>::
Tree to checkout from (when paths are given). If not specified,
the index will be used.

<branch>:: <branch>::
Branch to checkout (when no paths are given); may be any object Branch to checkout (when no paths are given); may be any object
ID that resolves to a commit. Defaults to HEAD. ID that resolves to a commit. Defaults to HEAD.
@ -132,6 +124,18 @@ As a special case, the `"@\{-N\}"` syntax for the N-th last branch
checks out the branch (instead of detaching). You may also specify checks out the branch (instead of detaching). You may also specify
`-` which is synonymous with `"@\{-1\}"`. `-` which is synonymous with `"@\{-1\}"`.


<new_branch>::
Name for the new branch.

<start_point>::
The name of a commit at which to start the new branch; see
linkgit:git-branch[1] for details. Defaults to HEAD.

<tree-ish>::
Tree to checkout from (when paths are given). If not specified,
the index will be used.




Detached HEAD Detached HEAD
------------- -------------

Loading…
Cancel
Save