diff options
Diffstat (limited to 'doc/user/project/merge_requests/squash_and_merge.md')
-rw-r--r-- | doc/user/project/merge_requests/squash_and_merge.md | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/doc/user/project/merge_requests/squash_and_merge.md b/doc/user/project/merge_requests/squash_and_merge.md index 4ff8ec3a7e6..39fd2588811 100644 --- a/doc/user/project/merge_requests/squash_and_merge.md +++ b/doc/user/project/merge_requests/squash_and_merge.md @@ -1,8 +1,14 @@ +--- +type: reference, concepts +--- + # Squash and merge -> [Introduced][ee-1024] in [GitLab Starter][ee] 8.17, and in [GitLab Core][ce] [11.0][ce-18956]. +> - [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1024) in [GitLab Starter](https://about.gitlab.com/pricing/) 8.17. +> - [Ported](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18956) to GitLab Core 11.0. -Combine all commits of your merge request into one and retain a clean history. +With squash and merge you can combine all your merge request's commits into one +and retain a clean history. ## Overview @@ -12,11 +18,11 @@ and then merges that commit using the merge method set for the project. In other words, squashing a merge request turns a long list of commits: -![List of commits from a merge request][mr-commits] +![List of commits from a merge request](img/squash_mr_commits.png) Into a single commit on merge: -![A squashed commit followed by a merge commit][squashed-commit] +![A squashed commit followed by a merge commit](img/squash_squashed_commit.png) The squashed commit's commit message will be either: @@ -44,20 +50,18 @@ all you have to do is enable squashing before you press merge to join the commits in the merge request into a single commit. This way, the history of your base branch remains clean with -meaningful commit messages and is simpler to [revert] if necessary. +meaningful commit messages and is simpler to [revert](revert_changes.md) if necessary. ## Enabling squash for a merge request Anyone who can create or edit a merge request can choose for it to be squashed on the merge request form: -![Squash commits checkbox on edit form][squash-edit-form] - ---- +![Squash commits checkbox on edit form](img/squash_edit_form.png) This can then be overridden at the time of accepting the merge request: -![Squash commits checkbox on accept merge request form][squash-mr-widget] +![Squash commits checkbox on accept merge request form](img/squash_mr_widget.png) ## Commit metadata for squashed commits @@ -69,19 +73,20 @@ The squashed commit has the following metadata: ## Squash and fast-forward merge -When a project has the [fast-forward merge setting enabled][ff-merge], the merge +When a project has the [fast-forward merge setting enabled](fast_forward_merge.md#enabling-fast-forward-merges), the merge request must be able to be fast-forwarded without squashing in order to squash it. This is because squashing is only available when accepting a merge request, so a merge request may need to be rebased before squashing, even though squashing can itself be considered equivalent to rebasing. -[ee-1024]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1024 -[ce-18956]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18956 -[mr-commits]: img/squash_mr_commits.png -[squashed-commit]: img/squash_squashed_commit.png -[squash-edit-form]: img/squash_edit_form.png -[squash-mr-widget]: img/squash_mr_widget.png -[ff-merge]: fast_forward_merge.md#enabling-fast-forward-merges -[ce]: https://about.gitlab.com/pricing/ -[ee]: https://about.gitlab.com/pricing/ -[revert]: revert_changes.md +<!-- ## Troubleshooting + +Include any troubleshooting steps that you can foresee. If you know beforehand what issues +one might have when setting this up, or when something is changed, or on upgrading, it's +important to describe those, too. Think of things that may go wrong and include them here. +This is important to minimize requests for support, and to avoid doc comments with +questions that you know someone might ask. + +Each scenario can be a third-level heading, e.g. `### Getting error message X`. +If you have none to add when creating a doc, leave this section in place +but commented out to help encourage others to add to it in the future. --> |