2.4 KiB
title, intro, redirect_from, versions, topics, shortTitle
| title | intro | redirect_from | versions | topics | shortTitle | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Configuring commit squashing for pull requests | You can enforce, allow, or disable commit squashing for all pull request merges on {% data variables.location.product_location %} in your repository. |
|
|
|
Configure commit squashing |
{% data reusables.pull_requests.configure_pull_request_merges_intro %}
{% data reusables.pull_requests.default-commit-message-squash-merge %}
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %}
-
On the "General" settings page (which is selected by default), scroll down to the section marked "Pull Requests".
-
Under "Pull Requests", select Allow squash merging. This allows contributors to merge a pull request by squashing all commits into a single commit. The default commit message presented to contributors when merging is the commit title and message if the pull request contains only 1 commit, or the pull request title and list of commits if the pull request contains 2 or more commits. {% ifversion default-merge-squash-commit-message %}
-
Optionally, under Allow squash merging, select the dropdown menu, then click the format of the default squash commit message presented to contributors when merging.
The default message uses the commit title and message if the pull request contains only 1 commit, or the pull request title and list of commits if the pull request contains 2 or more commits. You can also choose to use just the pull request title, the pull request title and commit details, or the pull request title and description. {% endif %}
If you select more than one merge method, collaborators can choose which type of merge commit to use when they merge a pull request. {% data reusables.repositories.squash-and-rebase-linear-commit-history %}