@@ -33,25 +33,27 @@ OPTIONS
33
33
of a remote (see the section <<REMOTES,REMOTES>> below).
34
34
35
35
<refspec>...::
36
- The canonical format of a <refspec> parameter is
37
- `+?<src>:<dst>`; that is, an optional plus `{plus}`, followed
38
- by the source ref, followed by a colon `:`, followed by
39
- the destination ref.
36
+ The format of a <refspec> parameter is an optional plus
37
+ `{plus}`, followed by the source ref <src>, followed
38
+ by a colon `:`, followed by the destination ref <dst>.
39
+ It is used to specify with what <src> object the <dst> ref
40
+ in the remote repository is to be updated.
40
41
+
41
- The <src> side represents the source branch (or arbitrary
42
- "SHA1 expression", such as `master~4` (four parents before the
43
- tip of `master` branch); see linkgit:git-rev-parse[1]) that you
44
- want to push. The <dst> side represents the destination location.
42
+ The <src> is often the name of the branch you would want to push, but
43
+ it can be any arbitrary "SHA-1 expression", such as `master~4` or
44
+ `HEAD` (see linkgit:git-rev-parse[1]).
45
45
+
46
- The local ref that matches <src> is used
47
- to fast forward the remote ref that matches <dst>. If
48
- the optional leading plus `+` is used , the remote ref is updated
49
- even if it does not result in a fast forward update .
46
+ The <dst> tells which ref on the remote side is updated with this
47
+ push. Arbitrary expressions cannot be used here, an actual ref must
48
+ be named. If `:`<dst> is omitted , the same ref as <src> will be
49
+ updated .
50
50
+
51
- `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
51
+ The object referenced by <src> is used to fast forward the ref <dst>
52
+ on the remote side. If the optional leading plus `{plus}` is used, the
53
+ remote ref is updated even if it does not result in a fast forward
54
+ update.
52
55
+
53
- A lonely <src> parameter (without a colon and a destination) pushes
54
- the <src> to the same name in the destination repository.
56
+ `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
55
57
+
56
58
Pushing an empty <src> allows you to delete the <dst> ref from
57
59
the remote repository.
@@ -190,23 +192,33 @@ git push origin master::
190
192
with it. If `master` did not exist remotely, it would be
191
193
created.
192
194
193
- git push origin :experimental ::
194
- Find a ref that matches `experimental` in the `origin` repository
195
- (e.g. `refs/heads/experimental`), and delete it .
195
+ git push origin HEAD ::
196
+ A handy way to push the current branch to the same name on the
197
+ remote .
196
198
197
199
git push origin master:satellite/master dev:satellite/dev::
198
200
Use the source ref that matches `master` (e.g. `refs/heads/master`)
199
201
to update the ref that matches `satellite/master` (most probably
200
202
`refs/remotes/satellite/master`) in the `origin` repository, then
201
203
do the same for `dev` and `satellite/dev`.
202
204
205
+ git push origin HEAD:master::
206
+ Push the current branch to the remote ref matching `master` in the
207
+ `origin` repository. This form is convenient to push the current
208
+ branch without thinking about its local name.
209
+
203
210
git push origin master:refs/heads/experimental::
204
211
Create the branch `experimental` in the `origin` repository
205
212
by copying the current `master` branch. This form is only
206
213
needed to create a new branch or tag in the remote repository when
207
214
the local name and the remote name are different; otherwise,
208
215
the ref name on its own will work.
209
216
217
+ git push origin :experimental::
218
+ Find a ref that matches `experimental` in the `origin` repository
219
+ (e.g. `refs/heads/experimental`), and delete it.
220
+
221
+
210
222
Author
211
223
------
212
224
Written by Junio C Hamano <
[email protected] >, later rewritten in C
0 commit comments