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

Re: [RFC PATCH] am: do not do any reset on --abort

From
Avery Pennarun <apenwarr@gmail.com>
Date
May 25, 2009, 16:10 UTC
Message-ID
<32541b130905250910r251e4667m2b63b651e1724b59@mail.gmail.com>
In-Reply-To
<20090525160207.GB5449@coredump.intra.peff.net>
On Mon, May 25, 2009 at 12:02 PM, Jeff King <peff@peff.net> wrote:
Show 10 quoted lines
> On Mon, May 25, 2009 at 02:17:48PM +0200, Johannes Sixt wrote:
>
>> I wonder why we have this problem (and do something about it) with git-am,
>> but not with git-rebase. Is it perhaps that the usual case were people
>> were bitten by the old behavior is:
>
> I don't know. I had assumed a safety valve we put in git-am might need
> to be matched in rebase. But I don't recall whether I have screwed
> myself in the same way with rebase. Perhaps because rebase happens on a
> detached HEAD, I tend to notice sooner that something is not right.

Ah, maybe that's the difference. rebase seems to detach the HEAD, then do a bunch of stuff, then reset the original branch only when it's done. So aborting doesn't reset any branches at all, it just checks out the original branch.

Thus one option would be to try to make am more like rebase: detach the HEAD before it starts, and reattach it only on success. At least then you only have one set of UI problems to fix.

(Of course, I've gotten myself into trouble anyway by checking new stuff in on the detached HEAD and later aborting a rebase. I have quite a love-hate relationship with detached HEADs.)

Maybe the best solution here isn't to prevent people from shooting themselves in the foot, but instead to help them recover afterwards. I've noticed most people don't know about 'git reflog'; they often seem astonished when I tell them about it. reflog + not blowing away dirty repositories would mean that you're always safe.

Have fun,
Avery
Previous: Jeff KingNext: Junio C Hamano
Message 13 of 14 in “Bug: 'git am --abort' can silently reset the wrong branch”
  1. Eduardo HabkostMay 6, 2009
  2. Jeff KingMay 8, 2009
  3. Sverre RabbelierMay 8, 2009
  4. Junio C HamanoMay 8, 2009
  5. Jeff KingMay 8, 2009
  6. am: do not do any reset on --abortJeff King, May 25, 2009
  7. Johannes SchindelinMay 25, 2009
  8. Jeff KingMay 25, 2009
  9. Johannes SixtMay 25, 2009
  10. Avery PennarunMay 25, 2009
  11. Jeff KingMay 25, 2009
  12. Jeff KingMay 25, 2009
  13. Avery PennarunMay 25, 2009
  14. Junio C HamanoMay 25, 2009

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.