Skip to content

Commit 1750783

Browse files
Anders Melchiorsengitster
authored andcommitted
Documentation: more git push examples
Include examples of using HEAD. The order of examples introduces new concepts one by one. This pushes the example of deleting a ref to the end of the list. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7a0d911 commit 1750783

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Documentation/git-push.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,33 @@ git push origin master::
191191
with it. If `master` did not exist remotely, it would be
192192
created.
193193

194-
git push origin :experimental::
195-
Find a ref that matches `experimental` in the `origin` repository
196-
(e.g. `refs/heads/experimental`), and delete it.
194+
git push origin HEAD::
195+
A handy way to push the current branch to the same name on the
196+
remote.
197197

198198
git push origin master:satellite/master dev:satellite/dev::
199199
Use the source ref that matches `master` (e.g. `refs/heads/master`)
200200
to update the ref that matches `satellite/master` (most probably
201201
`refs/remotes/satellite/master`) in the `origin` repository, then
202202
do the same for `dev` and `satellite/dev`.
203203

204+
git push origin HEAD:master::
205+
Push the current branch to the remote ref matching `master` in the
206+
`origin` repository. This form is convenient to push the current
207+
branch without thinking about its local name.
208+
204209
git push origin master:refs/heads/experimental::
205210
Create the branch `experimental` in the `origin` repository
206211
by copying the current `master` branch. This form is only
207212
needed to create a new branch or tag in the remote repository when
208213
the local name and the remote name are different; otherwise,
209214
the ref name on its own will work.
210215

216+
git push origin :experimental::
217+
Find a ref that matches `experimental` in the `origin` repository
218+
(e.g. `refs/heads/experimental`), and delete it.
219+
220+
211221
Author
212222
------
213223
Written by Junio C Hamano <[email protected]>, later rewritten in C

0 commit comments

Comments
 (0)