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

Re: [PATCH] rebase: add --forget to cleanup rebase, leave HEAD untouched

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 26, 2016, 16:51 UTC
Message-ID
<xmqq60ofcavd.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161026094658.20704-1-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 16 quoted lines
> There are occasions when you decide to abort an in-progress rebase and
> move on to do something else but you forget to do "git rebase --abort"
> first. Or the rebase has been in progress for so long you forgot about
> it. By the time you realize that (e.g. by starting another rebase)
> it's already too late to retrace your steps. The solution is normally
>
>     rm -r .git/<some rebase dir>
>
> and continue with your life. But there could be two different
> directories for <some rebase dir> (and it obviously requires some
> knowledge of how rebase works), and the ".git" part could be much
> longer if you are not at top-dir, or in a linked worktree. And
> "rm -r" is very dangerous to do in .git, a mistake in there could
> destroy object database or other important data.
>
> Provide "git rebase --forget" for this exact use case.
Two and a half comments.
 - The title says "leave HEAD untouched".  Are my working tree files
   and my index also safe from this operation, or is HEAD the only
   thing that is protected?
 - I think I saw a variant of this gotcha for an unconcluded
   cherry-pick that was left behind, which the bash-prompt script
   did not notice but the next "git cherry-pick" did by complaining
   "you are in the middle" or something like that.  Perhaps we would
   want to have a similarly sounding option to help that case, too,
   not in this patch but as another patch on the same theme?
 - Would it have helped if bash-prompt were in use?  I am not saying
   that this patch becomes unnecessary if you use it; I am trying to
   see if it helps its users by reminding them what state they are
   in.
Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 2 of 10 in “rebase: add --forget to cleanup rebase, leave HEAD untouched”
  1. rebase: add --forget to cleanup rebase, leave HEAD untouchedNguyễn Thái Ngọc Duy, Oct 26, 2016
  2. Junio C HamanoOct 26, 2016
  3. Duy NguyenOct 27, 2016
  4. Junio C HamanoOct 31, 2016
  5. rebase: add --forget to cleanup rebase, leave everything else untouchedNguyễn Thái Ngọc Duy, Nov 9, 2016
  6. Junio C HamanoNov 9, 2016
  7. Duy NguyenNov 10, 2016
  8. Duy NguyenNov 10, 2016
  9. Junio C HamanoNov 10, 2016
  10. rebase: add --forget to cleanup rebase, leave everything else untouchedNguyễn Thái Ngọc Duy, Nov 12, 2016

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.