Documentation: clarify branch creation

The documentation seems to assume that the starting point for a new
branch is the tip of an existing (ordinary) branch, but that is not
the most common case.  More often, "git branch" is used to begin
a branch from a remote-tracking branch, a tag, or an interesting
commit (e.g. origin/pu^2).  Clarify the language so it can apply
to these cases.  Thanks to Sean Estabrooks for the wording.

Also add a pointer to the user's manual for the bewildered.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jonathan Nieder 2009-10-09 13:34:08 -05:00 committed by Junio C Hamano
parent 58d2c961b3
commit bb35f35e67
1 changed files with 8 additions and 8 deletions

View File

@ -30,10 +30,8 @@ commit) will be listed. With `--no-merged` only branches not merged into
the named commit will be listed. If the <commit> argument is missing it the named commit will be listed. If the <commit> argument is missing it
defaults to 'HEAD' (i.e. the tip of the current branch). defaults to 'HEAD' (i.e. the tip of the current branch).


In the command's second form, a new branch named <branchname> will be created. The command's second form creates a new branch head named <branchname>
It will start out with a head equal to the one given as <start-point>. which points to the current 'HEAD', or <start-point> if given.
If no <start-point> is given, the branch will be created with a head
equal to that of the currently checked out branch.


Note that this will create the new branch, but it will not switch the Note that this will create the new branch, but it will not switch the
working tree to it; use "git checkout <newbranch>" to switch to the working tree to it; use "git checkout <newbranch>" to switch to the
@ -149,9 +147,9 @@ start-point is either a local or remote branch.
may restrict the characters allowed in a branch name. may restrict the characters allowed in a branch name.


<start-point>:: <start-point>::
The new branch will be created with a HEAD equal to this. It may The new branch head will point to this commit. It may be
be given as a branch name, a commit-id, or a tag. If this option given as a branch name, a commit-id, or a tag. If this
is omitted, the current branch is assumed. option is omitted, the current HEAD will be used instead.


<oldbranch>:: <oldbranch>::
The name of an existing branch to rename. The name of an existing branch to rename.
@ -216,7 +214,9 @@ SEE ALSO
-------- --------
linkgit:git-check-ref-format[1], linkgit:git-check-ref-format[1],
linkgit:git-fetch[1], linkgit:git-fetch[1],
linkgit:git-remote[1]. linkgit:git-remote[1],
link:user-manual.html#what-is-a-branch[``Understanding history: What is
a branch?''] in the Git User's Manual.


Author Author
------ ------