如何在选择操作后中止交互式rebase

new*_*ike 2 git

起初我想选择一些提交到壁球中,

但是我做错了什么,

我怎么能这次中止rebase,因为如果我键入'qa!' 要退出vim编辑器,它也会进行rebase.我不想要它.

在此输入图像描述

小智 7

你没有真正提供关于你在rebase过程中的位置的足够信息,但根据你的截图,我猜你已经超过了rebase编辑器部分:

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
Run Code Online (Sandbox Code Playgroud)

并且你已经在挤压一些提交.请注意,编辑说如下:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
Run Code Online (Sandbox Code Playgroud)

"空消息会中止提交".所以只留下一条空信息,保存并退出编辑器(:wq如果你正在使用Vim).

然后你将退出提交对话框,但你仍然会在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) $
Run Code Online (Sandbox Code Playgroud)

现在只需使用该--abort标志即可完成中止rebase:

(master|REBASE-i 4/4) $ git rebase --abort
(master) $
Run Code Online (Sandbox Code Playgroud)