考虑这种情况。我有5个提交A-B-C-D-E。我想使用rebase -i,以便提交B将具有提交D的所有更改。我该怎么做?
答案 0 :(得分:0)
Android.Widget.Button
编辑器弹出内容:
git rebase -i A
编辑内容:
pick B
pick C
pick D
pick E
保存并退出。
答案 1 :(得分:0)
您只需执行git rebase -i HEAD~4
,然后您就会看到
pick ae2c481 B
pick 2b1007f C
pick bcda8c5 D
pick 8591cea E
# Rebase 69f1cd1..8591cea onto 69f1cd1 (4 commands)
#
# 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
# d, drop = remove commit
#
# 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
然后做
pick ae2c481 B
squash bcda8c5 D
pick 2b1007f C
pick 8591cea E