Cancel rebase completely

I did a reboot like this:

git rebase --onto master new_background_processing export_background_processing 

This did not do what I wanted, so I performed a reset:

 git reset --hard HEAD@{1} 

I got my branch back to the state it was, but I got this message when I type git status:

 # You are currently rebasing branch 'export_background_processing' on 'e378641'. 

How to completely undo this reinstallation? Not sure what that means.

+118
git
Mar 09 '14 at 22:55
source share
4 answers

Use git rebase --abort . From the official Linux kernel documentation for git rebase :

 git rebase --continue | --skip | --abort | --edit-todo 
+206
Mar 09 '14 at 23:01
source share

In the case of the last permutation that you did not interrupt, you now (Git 2.12, Q1 2017) have git rebase --quit

See commit 9512177 (November 12, 2016) Nguyα»…n ThΓ‘i Ngọc Duy ( pclouds ) . (merger of Junio ​​C Hamano - gitster - on commit 06cd5a1 , December 19, 2016)

rebase : add --quit to clear the buffer, leave everything else untouched

There are times when you decide to interrupt the processing in the process and go to do something else, but you forget to do the " git rebase --abort " first . Or the permutation lasts so long that you forgot about it. By the time you realize that (for example, when starting another rebase) it is already too late to repeat the steps. Solution usually

 rm -r .git/<some rebase dir> 

and continue your life.
But for <some rebase dir> can be two different directories (and this obviously requires some knowledge of how rebase works), and the " .git " part can be much longer if you are not in the top directory or in the associated workgroup, And " rm -r " is very dangerous to do in .git , an error there can destroy the database of objects or other important data.

Provide " git rebase --quit " for this use case, mimicking the use case that is, " git cherry-pick --quit ".

+42
Dec 28 '16 at 13:36
source share

You are fortunate that you did not complete the rebase, so you can still do git rebase --abort . If you completed rebase (he rewrites the story), everything would be much more complicated. Before performing potentially destructive operations (in particular, rewriting history), think about how to mark the tips of the branches so that you can rewind them if something explodes.

+7
Mar 09 '14 at 23:05
source share

If you are rebasing, rebase has already begun, which you want to cancel , just comment (#) all the commits listed in the rebase editor.

As a result, you will get a command line message

 Nothing to do 
+2
Aug 07 '18 at 16:48
source share



All Articles