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

Re: [RFD] make rebase abort to original branch, not rebased branch

From
AMAlexander Miseler <alexander@miseler.de>
Date
Mar 13, 2011, 15:27 UTC
Message-ID
<4D7CE26F.9070608@miseler.de>
In-Reply-To
<alpine.DEB.2.00.1103131013370.15442@debian>
Show 22 quoted lines
>>> In most cases, this is just a small annoyance, since it's usually
>>> quick and easy to manually switch back to the original
>>> branch. However, I have run into at least two cases where it has been
>>> a bit more annoying:
>>>
>>>  1. When on a detached HEAD and running "git rebase HEAD topic", if
>>>     you abort the rebase, you will have to look up the old commit in
>>>     the reflog.
>>
>> Doesn't this merely show a bad discipline? What were you envisioning to
>> do to your detached HEAD state if the rebase were to succeed? IOW, if the
>> state was so precious, why did you decide to switch to topic and rebase it
>> onto that state, without marking?
> 
> This usually happens when I see something that looks a bit suspicious
> in one of my own commits on my topic branch. I then check out that
> commit to have a look and perhaps run some test. If I find something
> broken, I would fix it and either amend the commit or create a new
> commit on top. I would then run "git rebase --onto HEAD HEAD~1 topic"
> or "git rebase HEAD topic", respectively. If the merge conflicts turn
> out to be bigger than I expected, I may decide to abort and to instead
> create a new branch for the commit(s) until I find time/energy.
This can be easily fixed for your own repository by installing a pre-rebase hook that force-sets a temporary branch (named e.g. "pre-rebase") to the current commit before starting the rebase. I can highly recommend having such a hook, it's damn useful.
Previous: Martin von Zweigbergk
Message 5 of 5 in “[RFD] make rebase abort to original branch, not rebased branch”
  1. Martin von ZweigbergkMar 13, 2011
  2. Junio C HamanoMar 13, 2011
  3. Junio C HamanoMar 13, 2011
  4. Martin von ZweigbergkMar 13, 2011
  5. Alexander MiselerMar 13, 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.