doc/user/project/merge_requests/squash_and_merge.md
{{< details >}}
{{< /details >}}
Squash and merge combines multiple small commits into a single meaningful commit. This strategy keeps your repository history clean and makes it easier to track or revert changes. When you work on multiple features at once, squashing separates each feature's changes into distinct, logical units.
Each time a branch merges into your base branch, up to two commits are added:
By default, squashed commits contain the following metadata:
Project owners can create new default messages for all squash commits and merge commits.
Users with permission to create or edit a merge request can set the default squash options for a merge request.
Prerequisites:
To do this:
If your project allows you to select squashing options for merge requests, to squash the commits as part of the merge process:
Prerequisites:
To configure the default squashing behavior for all merge requests in your project: