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

Re: git-push branch confusion caused by user mistake

From
Jacob Keller <jacob.keller@gmail.com>
Date
Mar 13, 2017, 08:54 UTC
Message-ID
<CA+P7+xp1T0-02=NznW0=Xd_K5_bdtg=nVgtTqT74+EJuncYxSw@mail.gmail.com>
In-Reply-To
<xmqqzigswzk9.fsf@gitster.mtv.corp.google.com>
On Fri, Mar 10, 2017 at 2:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
> Phil Hord <phil.hord@gmail.com> writes:
>
>> I think git should be smarter about deducing the dest ref from the
>> source ref if the source ref is in refs/remotes, but I'm not sure how
>> far to take it.
>
> My knee-jerk reaction is "Don't take it anywhere".
>
> Giving a refspec from the command line is an established way to
> defeat the default behaviour when you do not give any and only the
> remote, and making it do things behind user's back, you would be
> robbing the escape hatch from people.
>
> It often is useful in real-life workflow when "git push $dest
> origin/master" does exactly the way it works now, which I actually
> use myself.  Imagine that you have two repositories, use one of them
> primarily to interact with the outside world and do your work, but
> you then occasionally push from that primary repository to the other
> one, instead of logging into the host that has the other one and
> running a fetch on that host from the outside world.  Your "trying
> to be clever when given a colon-less refspec" will force people to
> type "git push $dest origin/master:origin/master" in such a case.
>
>

It might be worth having some warning or something happen here? I've had several co-workers at $DAYJOB get confused by this sort of thing.

Thanks, Jake

Previous: Junio C HamanoNext: Phil Hord
Message 3 of 5 in “git-push branch confusion caused by user mistake”
  1. Phil HordMar 10, 2017
  2. Junio C HamanoMar 10, 2017
  3. Jacob KellerMar 13, 2017
  4. Phil HordMar 13, 2017
  5. Jakub NarębskiMar 11, 2017

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.