Skip to content

Squashing GIT Commits

Stuart Foulds-Duncan edited this page Mar 5, 2017 · 2 revisions

From time to time, the SynoCommunity team will request that you squash your commits before a merge can occur.

This helps us have a cleaner look at the files that have changed and improves the history within the master repo.

Here is a guide on how to squash your commits:


First, use the following command to see a list of your recent commits

git log --oneline

Count how many commits you'll need to go back, then press q to exit the log.

So now you've found how many commits you need to squash, take that number (for example: 5) and run the following command (substituting 5 for the number of commits you need to squash)

git reset –soft HEAD~5

Now commit just your changes

git commit

Double-check which branch you're on (just to be safe!)

git branch

And push your commit

git push

Et voila! You should now have your last 5 commits squashed into a single commit.

Now you're ready to submit that pull request!

Clone this wiki locally