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:
- Navigate to your chosen repository and open the Settings sub-tab
- Open the General Settings page
- 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:
- Navigate to your chosen repository and open the Merge Requests sub-tab
- Open the merge request in question from the list
- Click on the Edit button on the right of the screen
- Check the box marked
- Squash commits into one on merge shown in the image below
- 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 firstname.lastname@example.org