Re: [PATCH] push: change needlessly ambiguous example in error
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Nov 13, 2018, 21:55 UTC
- Message-ID
- <87wopg1w2z.fsf@evledraar.gmail.com>
- In-Reply-To
- <1615698920.2718456.1542145071499.JavaMail.zimbra@matthieu-moy.fr>
On Tue, Nov 13 2018, Matthieu Moy wrote:
Show 18 quoted lines
> Ævar Arnfjörð Bjarmason" <avarab@gmail.com> wrote: > >> Let's use "git push <remote> HEAD" which always means push the current >> branch name to that remote, instead of "git push <remote> >> <current-branch-name>" which will do that under "simple", but is not >> guaranteed to do under "upstream". > > Probably a good idea indeed. > > One potential objection though: I think many people know > > git push origin master > > (not that they necessarily understand it, but I've seen many people talking > or asking questions about what "origin master" is) > > This "git push origin HEAD" is IMHO less common. It may confuse users. > Or users may learn it and be happy thanks to your message. I don't know.
I was hoping for the latter. I'm slightly embarrassed to say that for the entire time I've been using git I've been doing:
# on branch 'topic'
git push origin topic:topicWhere 'topic' is a tracking branch of 'origin/master' (I use push.default=upstream). I only recently discovered that I could push to 'HEAD" to do the same thing. So one ulterior motive is to make that more prominent.
I was going to add a hint on such invocations saying "you can just use HEAD", but have not found the relevant code yet after some brief searching...