如果您只是想找到修复早期提交的简单解决方案,请阅读问题!它解释了一切.但是,既然Elmarco要求一个光滑的方式,我们在这里:
从Git 1.7.0开始,有一个--autosquash
选项可以满足rebase
您的需求.也有--fixup
和--squash
选项commit
,使事情变得更容易.通过一些别名,您甚至可以将整个事情整合到一个命令中.
我建议升级到最新的Git以获得最大的惊人效果:
git/Documentation/RelNotes $ grep -i -A1 autosquash\\\|fixup * 1.7.0.txt: * "git rebase -i" learned new action "fixup" that squashes the change 1.7.0.txt- but does not affect existing log message. -- 1.7.0.txt: * "git rebase -i" also learned --autosquash option that is useful 1.7.0.txt: together with the new "fixup" action. 1.7.0.txt- -- 1.7.3.txt: * "git rebase -i" peeks into rebase.autosquash configuration and acts as 1.7.3.txt: if you gave --autosquash from the command line. 1.7.3.txt- -- 1.7.4.txt: * "git commit" learned --fixup and --squash options to help later invocation 1.7.4.txt- of the interactive rebase. -- 1.7.4.txt: * "git rebase --autosquash" can use SHA-1 object names to name which 1.7.4.txt: commit to fix up (e.g. "fixup! e83c5163"). 1.7.4.txt-