这是我当前的日志,从最近的提交到最近的提交:
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压缩到单个提交中,并保持提交A单独,以便它看起来像这样:
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
它提示我输入提交消息,自动填充提交B
中的现有消息,然后失败,说You asked to amend the most recent commit, but doing so would make it empty.
如何获得我想要的历史记录?
答案 0 :(得分:1)
您可以:
git commit --allow-empty
git rebase --continue
git rebase -i HEAD~~
# fixup or remove second (empty) commit