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
Michael J Gruber <git@drmicha.warpmail.net>
Date
Apr 8, 2011, 09:30 UTC
Message-ID
<4D9ED5AC.3050106@drmicha.warpmail.net>
In-Reply-To
<7vbp0h63sw.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 08.04.2011 01:26:
Show 13 quoted lines
> Thomas Adam <thomas@xteddy.org> writes:
> 
>> 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.
> 
> Just like you can checkout the previous branch back if you found you
> checked out a wrong branch by a typo, if you found that you merged a wrong
> branch, you can just reset it away back to ORIG_HEAD, no?
> 
> Or am I missing something more obvious?
Only tests and doc :)

Seriously, I like that. If there are more places where this makes sense (I haven't looked) we might even factor it out. In principle it makes sense everywhere where a branch name makes sense, e.g.:

git branch -D foo #...can't delete the current branch git checkout whatever git branch -D -

In this case, shell history is faster, of course.
Michael
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 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.