git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] push: change needlessly ambiguous example in error

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 14, 2018, 04:32 UTC
Message-ID
<xmqqva50p9c6.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<87wopg1w2z.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 13 quoted lines
>> 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:topic
>
> Where '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.

Personally I do not think you should feel embarrassed at all. I didn't know it myself, and I do not recall designing such a behaviour, so I would not be surprised if it is merely what the code right now happens to do. FWIW, I would have expected that a "git push origin HEAD" when HEAD is a symref to a branch 'x' would behave as if "git push origin x" were given, going through the usual simple/upstream/matching etc. dance.

Do we consider the current behaviour useful? Is it documented already and widely known? If the answers are yes/no, of course we should document it, but if they are no/no, it may not be a bad idea to deprecate it and replace it with a saner version (i.e. deref HEAD to branch name and behave the same way as pushing that branch) over time.

Previous: Ævar Arnfjörð BjarmasonNext: Matthieu Moy
Message 4 of 6 in “push: change needlessly ambiguous example in error”
  1. push: change needlessly ambiguous example in errorÆvar Arnfjörð Bjarmason, Nov 13, 2018
  2. Matthieu MoyNov 13, 2018
  3. Ævar Arnfjörð BjarmasonNov 13, 2018
  4. Junio C HamanoNov 14, 2018
  5. Matthieu MoyNov 14, 2018
  6. Junio C HamanoNov 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.