How to Squash Commits on Merge
Toshi Dávila avatar
Written by Toshi Dávila
Updated over a week ago

Sometimes, when merging a long list of changes from a development branch into the master, it’s useful to squash those commits into one change for ease of review and to declutter the repo’s commit history. Assembla offers the option to squash all of the commits in a merge request into one commit after the merge is approved and completed.

Enabling Commit Squashing by Default

To enable commit squashing as the default option in your repository:

  1. Navigate to your chosen repository and open the Settings sub-tab

  2. Open the General Settings page 

  3. Check the box for Squash commits on merge default enabled

Squash Commits For One Merge Request

If you don’t want to squash commits by default, but happen to have one merge request that you’d like to squash, you can squash commits for only some merge requests.

To do so, follow these steps:

  1. Navigate to your chosen repository and open the Merge Requests sub-tab

  2. Open the merge request in question from the list

  3. Click on the Edit button on the right of the screen

  4. Check the box marked 

  5. Squash commits into one on merge shown in the image below

  6. All of the commits listed in the merge request will squash into one commit when the merge is completed

What Will The Squashed Commit Message Look Like?

The final squashed commit message will match the title of the merge request as seen in the WebApp.

The commit message in the "To" branch will read as shown:



Need help? Please contact us at support@assembla.com 

Did this answer your question?