这是我当前的日志,从最近的提交到最近的提交:
E I want this message
D I don't want this message
C Don't want this message
B Don't want this message
A Want this commit separately
我想将提交B-E压缩到一个提交中,并保持提交一个单独的,所以它看起来像这样:
F I want this message
A Want this commit separately
其中F
包含从B
到E
的所有变化。我试过这个:
git rebase -i A
pick A Want this commit separately
reword B I want this message
fixup C
fixup D
fixup E
它提示我输入提交消息,自动填充commit B
中的现有消息,然后失败,说You asked to amend the most recent commit, but doing so would make it empty.
我怎样才能得到我想要的历史?
你或许可以:
git commit --allow-empty
git rebase --continue
git rebase -i HEAD~~
# fixup or remove second (empty) commit