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

3

首先我想把一些提交合并成一个,

但是我做错了什么,

这次如何中止变基操作呢?因为如果我键入 'qa!' 退出 vim 编辑器,它也会执行变基操作。我不想这样。

enter image description here


@Makoto 我不同意这是重复的,链接的问题和这个问题处理的情况略有不同,并且链接问题上的答案并不是正确的方法。 - user456814
这可能是一个重复的问题:https://dev59.com/1GQn5IYBdhLWcg3wvpUV - jcm
":q!" 对我有用,它显示“成功地重新设置基础”,但实际上它什么也没做。 - itsjavi
1个回答

9

您并没有提供足够的关于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

假设你正在压缩一些提交,编辑器会提示以下内容:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.

“一个空的信息会终止提交”。只需留下空消息,保存并退出您的编辑器(如果您使用Vim,则为:`:wq`)。
然后您将退出提交对话框,但您仍然处于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) $

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

(master|REBASE-i 4/4) $ git rebase --abort
(master) $

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接