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

From: Junio C Hamano <[email-masked]>
Date: Mon, 31 Oct 2016 12:25:48 -0700

Duy Nguyen <[email-masked]> writes:

> On Wed, Oct 26, 2016 at 11:51 PM, Junio C Hamano <[email-masked]> wrote:
>> Nguyễn Thái Ngọc Duy  <[email-masked]> writes:
>>
>>> 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?
>
> Everything is protected. I will rephrase the title a bit. The option
> is basically a safe form of "rm -r .git/rebase-{apply,merge}".

We are not in a hurry, as it is not likely that this will hit 2.11
even if we saw a rerolled version yesterday, but it would be nice to
cook it on 'next' so that it can be on 'master' early after the
upcoming release.

Thanks.