我已经回顾了几个关于压缩最新提交和压缩根提交的相关问题,但这两个问题都不能帮助我压缩不是根本的非最近提交.
这是我的开始场景:
D---E---F---G---H---I---J master
Run Code Online (Sandbox Code Playgroud)
和我想要的结果:
D---E---Z---I---J master
Run Code Online (Sandbox Code Playgroud)
什么Z是壁球F---G---H,和F---G---H,D---E和,I---J可以是任意长的非分支提交序列.
第一种方法:
[lucas]/home/blah/$ git rebase -i D
rebase in progress; onto D
You are currently editing a commit while rebasing branch 'master' on 'D'.
No changes
You asked to amend the most recent commit, but doing so would make
it empty. You can repeat your command with --allow-empty, or you can
remove the commit entirely with "git reset HEAD^". …Run Code Online (Sandbox Code Playgroud)