@matheusbsbs / matheus-bagliano / commits / 4e560158c6
Fork 0

Include a git-push example for creating a remote branch

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>

Shawn O. Pearce committed Sep 6, 2007 at 00:44 UTC 4e560158c6de154fafab9fc3f6028d9edcc53e6b
1 file changed +6
Documentation/git-push.txt
+6
@@ -117,6 +117,12 @@ git push origin master:satellite/master::
117 the ref that matches `satellite/master` (most likely, it would
118 be `refs/remotes/satellite/master`) in `origin` repository with it.
119
120 +git push origin master:refs/heads/experimental::
121 + Create the branch `experimental` in the `origin` repository
122 + by copying the current `master` branch. This form is usually
123 + needed to create a new branch in the remote repository as
124 + there is no `experimental` branch to match.
125 +
126 Author
127 ------
128 Written by Junio C Hamano <junkio@cox.net>, later rewritten in C