Skip to content

Commit

Permalink
doc/checkout: refer to git-branch(1) as appropriate
Browse files Browse the repository at this point in the history
Most of description for the branch creation options is
simply cut and paste from git-branch. There are two reasons
to fix this:

  1. It can grow stale with respect to what's in "git
     branch" (which it is now is).

  2. It is not just an implementation detail, but rather the
     desired mental model for the command that we are using
     "git branch" here. Being explicit about that can help
     the user understand what is going on.

It also makes sense to strip the branch creation options
from the synopsis, as they are making it a long,
hard-to-read line. They are still easily discovered by
reading the options list, and --track is explicitly
referenced when branch creation is described.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Apr 13, 2009
1 parent 167d744 commit 26d22dc
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions Documentation/git-checkout.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-checkout - Checkout a branch or paths to the working tree
SYNOPSIS
--------
[verse]
'git checkout' [-q] [-f] [-t | --track | --no-track] [-b <new_branch> [-l]] [-m] [<branch>]
'git checkout' [-q] [-f] [-m] [-b <new_branch>] [<branch>]
'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...

DESCRIPTION
Expand All @@ -18,8 +18,9 @@ When <paths> are not given, this command switches branches by
updating the index and working tree to reflect the specified
branch, <branch>, and updating HEAD to be <branch> or, if
specified, <new_branch>. Using -b will cause <new_branch> to
be created; in this case you can use the --track or --no-track
options, which will be passed to `git branch`.
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
name is constructed from the specified branch name by stripping
Expand Down Expand Up @@ -62,22 +63,12 @@ entries; instead, unmerged entries are ignored.

-b::
Create a new branch named <new_branch> and start it at
<branch>. The new branch name must pass all checks defined
by linkgit:git-check-ref-format[1]. Some of these checks
may restrict the characters allowed in a branch name.
<branch>; see linkgit:git-branch[1] for details.

-t::
--track::
When creating a new branch, set up configuration so that 'git-pull'
will automatically retrieve data from the start point, which must be
a branch. Use this if you always pull from the same upstream branch
into the new branch, and if you don't want to use "git pull
<repository> <refspec>" explicitly. This behavior is the default
when the start point is a remote branch. Set the
branch.autosetupmerge configuration variable to `false` if you want
'git checkout' and 'git branch' to always behave as if '--no-track' were
given. Set it to `always` if you want this behavior when the
start point is either a local or remote branch.
When creating a new branch, set up "upstream" configuration. See
"--track" in linkgit:git-branch[1] for details.
+
If no '-b' option is given, the name of the new branch will be
derived from the remote branch. If "remotes/" or "refs/remotes/"
Expand All @@ -94,9 +85,8 @@ explicitly give a name with '-b' in such a case.
branch.autosetupmerge configuration variable is true.

-l::
Create the new branch's reflog. This activates recording of
all changes made to the branch ref, enabling use of date
based sha1 expressions such as "<branchname>@\{yesterday}".
Create the new branch's reflog; see linkgit:git-branch[1] for
details.

-m::
--merge::
Expand Down

0 comments on commit 26d22dc

Please sign in to comment.