pillarOfLight
pillarOfLight

Reputation: 8982

git squashing multiple commits into multiple commits

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?

Upvotes: 2

Views: 121

Answers (1)

er0
er0

Reputation: 1834

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.

Upvotes: 8

Related Questions