Here’s how to combine commit that’s actually doing the same thing. This helps you clean up multiple commit.
1. Check your logs and count up to where you want to merge. Count from the very last commit down to the commit you want to merge with.
2. Let say latest commit down to 5. Here’s how to merge those commit in one, preserving all 5 commit messaging.
git rebase -i HEAD~5
3. It will give you a window of all the commit, each line will have the word “pick”, remove “pick” if you don’t want to include specific commit. replace “pick” with “squash” or “s” for all those commit that you want to merge.
4. Save, git will then ask you to make final commit message to describe merged commits.
5. Issue git log to see the changes made.