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

Re: [PATCH] merge: allow "-" as a short-hand for "previous branch"

From
Thomas Adam <thomas@xteddy.org>
Date
Apr 7, 2011, 23:13 UTC
Message-ID
<BANLkTikA3dFQpZWC=TC3+zp2FS=uBBxf0Q@mail.gmail.com>
In-Reply-To
<7vmxk164wd.fsf@alter.siamese.dyndns.org>
Hi,
On 8 April 2011 00:03, Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
> Just like "git checkout -" is a short-hand for "git checkout @{-1}" to
> conveniently switch back to the previous branch, "git merge -" is a
> short-hand for "git merge @{-1}" to conveniently merge the previous branch.
>
> It will allow me to say:
>
>    $ git checkout -b au/topic
>    $ git am -s ./+au-topic.mbox
>    $ git checkout pu
>    $ git merge -

I agree this is is useful, but is there a danger of this being a common typo, and people merging in previous branches a lot more often than they ever intended? In the case of "git checkout -" that's not as fatal, but if I ever mistype "git merge -" -- I'm now left with an unraveling exercise to do.

Hopefully it won't be an issue, as it's no worse than mistyping branch names -- I suppose it's the sheer length of "-" in this case which leads to more potential for problems.

-- Thomas Adam
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 5 in “merge: allow "-" as a short-hand for "previous branch"”
  1. merge: allow "-" as a short-hand for "previous branch"Junio C Hamano, Apr 7, 2011
  2. Thomas AdamApr 7, 2011
  3. Junio C HamanoApr 7, 2011
  4. Michael J GruberApr 8, 2011
  5. Junio C HamanoApr 8, 2011

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.