Skip to content

Commit

Permalink
Merge branch 'am/maint-push-doc' into maint
Browse files Browse the repository at this point in the history
* am/maint-push-doc:
  Documentation: rework src/dst description in git push
  Documentation: more git push examples
  Documentation: simplify refspec format description
  • Loading branch information
Junio C Hamano committed Feb 6, 2009
2 parents f20408d + 8039184 commit 7b26171
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 23 deletions.
48 changes: 30 additions & 18 deletions Documentation/git-push.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,27 @@ OPTIONS
of a remote (see the section <<REMOTES,REMOTES>> below).

<refspec>...::
The canonical format of a <refspec> parameter is
`+?<src>:<dst>`; that is, an optional plus `{plus}`, followed
by the source ref, followed by a colon `:`, followed by
the destination ref.
The format of a <refspec> parameter is an optional plus
`{plus}`, followed by the source ref <src>, followed
by a colon `:`, followed by the destination ref <dst>.
It is used to specify with what <src> object the <dst> ref
in the remote repository is to be updated.
+
The <src> side represents the source branch (or arbitrary
"SHA1 expression", such as `master~4` (four parents before the
tip of `master` branch); see linkgit:git-rev-parse[1]) that you
want to push. The <dst> side represents the destination location.
The <src> is often the name of the branch you would want to push, but
it can be any arbitrary "SHA-1 expression", such as `master~4` or
`HEAD` (see linkgit:git-rev-parse[1]).
+
The local ref that matches <src> is used
to fast forward the remote ref that matches <dst>. If
the optional leading plus `+` is used, the remote ref is updated
even if it does not result in a fast forward update.
The <dst> tells which ref on the remote side is updated with this
push. Arbitrary expressions cannot be used here, an actual ref must
be named. If `:`<dst> is omitted, the same ref as <src> will be
updated.
+
`tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
The object referenced by <src> is used to fast forward the ref <dst>
on the remote side. If the optional leading plus `{plus}` is used, the
remote ref is updated even if it does not result in a fast forward
update.
+
A lonely <src> parameter (without a colon and a destination) pushes
the <src> to the same name in the destination repository.
`tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
+
Pushing an empty <src> allows you to delete the <dst> ref from
the remote repository.
Expand Down Expand Up @@ -190,23 +192,33 @@ git push origin master::
with it. If `master` did not exist remotely, it would be
created.

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

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

git push origin HEAD:master::
Push the current branch to the remote ref matching `master` in the
`origin` repository. This form is convenient to push the current
branch without thinking about its local name.

git push origin master:refs/heads/experimental::
Create the branch `experimental` in the `origin` repository
by copying the current `master` branch. This form is only
needed to create a new branch or tag in the remote repository when
the local name and the remote name are different; otherwise,
the ref name on its own will work.

git push origin :experimental::
Find a ref that matches `experimental` in the `origin` repository
(e.g. `refs/heads/experimental`), and delete it.


Author
------
Written by Junio C Hamano <gitster@pobox.com>, later rewritten in C
Expand Down
9 changes: 4 additions & 5 deletions Documentation/pull-fetch-param.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
of a remote (see the section <<REMOTES,REMOTES>> below).

<refspec>::
The canonical format of a <refspec> parameter is
`+?<src>:<dst>`; that is, an optional plus `{plus}`, followed
by the source ref, followed by a colon `:`, followed by
the destination ref.
The format of a <refspec> parameter is an optional plus
`{plus}`, followed by the source ref <src>, followed
by a colon `:`, followed by the destination ref <dst>.
+
The remote ref that matches <src>
is fetched, and if <dst> is not empty string, the local
ref that matches it is fast forwarded using <src>.
Again, if the optional plus `+` is used, the local ref
If the optional plus `+` is used, the local ref
is updated even if it does not result in a fast forward
update.
+
Expand Down

0 comments on commit 7b26171

Please sign in to comment.