问题
In light of this:
Combining multiple commits before pushing in Git
suppose I have this rebase:
pick 16b5fcc msg1
pick c964dea msg3
pick 06cf8ee msg1
pick 396b4a3 msg2
pick 9be7fdb msg3
pick 7dba9cb msg2
Suppose I want to combine all comitts with the same message into one...(ie all msg1 commits into a single msg1 commit, all msg2 commits into 1 msg2 commit, etc)
How should I go about squashing these?
回答1:
git-rebase lets you reorder and squash commits. Something like this ought to work:
pick 16b5fcc msg1
squash 06cf8ee msg1
pick 396b4a3 msg2
squash 7dba9cb msg2
pick 9be7fdb msg3
squash c964dea msg3
If you have a lot of commits, I would suggest you write a script to group them as above.
来源:https://stackoverflow.com/questions/14146647/git-squashing-multiple-commits-into-multiple-commits