example:
git rebase -i HEAD~4
:
pick 07c5abd 1.txt
pick de9b1eb 2.txt
pick 3e7ee36 3.txt
pick fa20af3 4.txt
# Rebase 8db7e8b..fa20af3 onto 8db7e8b
#
# 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
如果选 pick
, 则git不会有任何改动。
如果改成:
pick 07c5abd 1.txt
pick de9b1eb 2.txt
reword 3e7ee36 3.txt
pick fa20af3 4.txt
则git 会接着跳出一个界面允许你编辑 3.txt 这条comment信息。
如果改成:
pick 07c5abd 1.txt
squash de9b1eb 2.txt
squash 3e7ee36 3.txt
squash fa20af3 4.txt
则 git 会将这四条 commit 信息合并成一个 commit 信息。