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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 26, 2016 at 11:51 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> 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}".

>  - 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?

That would be nice. I don't put lots of git info on my shell prompt
though, so it does not help me. And it's probably difficult to report
the right thing too. Sometimes in the middle of rebase I would switch
to another branch, look or do stuff, then "git checkout -" back. I
don't think we can make the prompt script clever enough to see my
intention.

>  - 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.

Since I don't use it because I want to keep shell prompt short and
light, it doe not help me. But it looks like git-prompt.sh does print
rebase in progress and others (only checked the code, didn't test it).
-- 
Duy




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]