At first I want to select some commits into into squash,
But I did something wrong ,
How could I abort rebase this time, Because If I type 'qa!' to quit the vim editor, it'll also do the rebase. I don't want it.
At first I want to select some commits into into squash,
But I did something wrong ,
How could I abort rebase this time, Because If I type 'qa!' to quit the vim editor, it'll also do the rebase. I don't want it.
You didn't really provide a enough information about where in the rebase process you are, but based on your screenshot, I'm guessing that you've already gotten past the rebase editor part:
pick c843ea2 Set Vim column limit to 80 (OS X)
pick fc32eac Add Bash alias for `pbcopy` (OS X)
pick 7b9dbdd Add foo.txt for test
pick 5e45c82 Add doop.txt
# Rebase 320ed55..5e45c82 onto 320ed55
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
and that you're already in the middle of squashing some commits. Notice that the editor says the following:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
"An empty message aborts the commit". So just leave an empty message, save, and quit your editor (which is :wq
if you're using Vim).
Then you'll be dropped out of the commit dialog, but you'll still be in the middle of the rebase:
(master) $ git rebase -i head~4
Aborting commit due to empty commit message.
Could not apply 5e45c82a85818bd05e7fce3844ec720a8f99a418... Add doop.txt
(master|REBASE-i 4/4) $
Now just simply use the --abort
flag to finish aborting the rebase:
(master|REBASE-i 4/4) $ git rebase --abort
(master) $