Skip to content

Commit

Permalink
Include a git-push example for creating a remote branch
Browse files Browse the repository at this point in the history
Many users get confused when `git push origin master:foo` works
when foo already exists on the remote repository but are confused
when foo doesn't exist as a branch and this form does not create
the branch foo.

This new example highlights the trick of including refs/heads/
in front of the desired branch name to create a branch.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Sep 6, 2007
1 parent 432e93a commit 4e56015
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Documentation/git-push.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ git push origin master:satellite/master::
the ref that matches `satellite/master` (most likely, it would
be `refs/remotes/satellite/master`) in `origin` repository with it.

git push origin master:refs/heads/experimental::
Create the branch `experimental` in the `origin` repository
by copying the current `master` branch. This form is usually
needed to create a new branch in the remote repository as
there is no `experimental` branch to match.

Author
------
Written by Junio C Hamano <junkio@cox.net>, later rewritten in C
Expand Down

0 comments on commit 4e56015

Please sign in to comment.