push docs: inaccurate description of omitted destination?
It seems to me that push's manpage contains a couple of inaccurate (or at least confusingly incomplete) statements about omitting the destination part of the refspec.
First, the refspec section of the manpage has this to say:
If git push [<repository>] without any <refspec> argument is set to update some ref at the destination with <src> with remote.<repository>.push configuration variable, :<dst> part can be omitted--such a push will update a ref that <src> normally updates without any <refspec> on the command line. Otherwise, missing :<dst> means to update the same ref as the <src>.
Reading that, I'd think that, if I haven't configured remote.<repository>.push in a way that involves <src>, omitting <dst> will update the remote ref with the same name. But push.default is also consulted before falling back entirely to using the remote ref with the same name:
$ git rev-parse --symbolic-full-name HEAD
refs/heads/topic
$ git rev-parse --symbolic-full-name @{upstream}
refs/remotes/origin/master
$ git -c push.default=upstream push -n origin topic ;# unmentioned case
To ../rem
09cc638..58f7f72 topic -> master $ git branch --unset-upstream topic
$ git -c push.default=upstream push -n origin topic ;# fallback case
To ../rem
* [new branch] topic -> topicSecond, the example section says
git push origin master::
Find a ref that matches master in the source repository (most likely, it would find refs/heads/master), and update the same ref (e.g. refs/heads/master) in origin repository with it. If master did not exist remotely, it would be created.
Perhaps I'm misreading that, but I'd interpret that as saying the remote ref with the same name will always be updated, but that doesn't match the refspec description of an omitted destination shown above or the push.default-dependent behavior demonstrated in the example above.
Quoted 13 lines · Kyle Meyer
It seems to me that push's manpage contains a couple of inaccurate (or at least confusingly incomplete) statements about omitting the destination part of the refspec.
First, the refspec section of the manpage has this to say:
If
git push [<repository>]without any<refspec>argument is set to update some ref at the destination with<src>withremote.<repository>.pushconfiguration variable,:<dst>part can be omitted--such a push will update a ref that<src>normally updates without any<refspec>on the command line. Otherwise, missing:<dst>means to update the same ref as the<src>.
Quoted 3 lines
Reading that, I'd think that, if I haven't configured remote.<repository>.push in a way that involves <src>, omitting <dst> will update the remote ref with the same name.
... if such a push would update the ref at the remote with the same name, yes. Otherwise no. And that is determined by what push mode is being used (e.g. are we using the matching mode? The current mode? Something else?).
Quoted 3 lines
But push.default is also
consulted before falling back entirely to using the remote ref with the same name:
Yes. The push.default configuration participates in the selection of the ref at the remote that gets updated, given a refspec element with a missing :<dst>. And you do not have to write :<dst> to name the ref that a refspec with missing :<dst> would update anyway.
Quoted 9 lines
git push origin master::
Find a ref that matchesmasterin the source repository (most likely, it would findrefs/heads/master), and update the same ref (e.g.refs/heads/master) inoriginrepository with it. Ifmasterdid not exist remotely, it would be created.Perhaps I'm misreading that, but I'd interpret that as saying the remote ref with the same name will always be updated,...
That part is random listing of examples with vanilla configuration, so depending on what setting you personally have, the behaviour may be different.