Use merge strategies for pull requests

Merge strategies provide you with methods for merging commits. As an administrator or space owner, you can set merge strategies for pull requests in a Git repository.

Note: Merge strategies are not the same as merge rules. Merge strategies control how pull requests are merged, while merge rules control who can merge pull requests. For details, see Create merge rules.

Available merge strategies

The following table describes merge strategies that are available by default.

Merge strategy Description
Merge commit

Keeps all commits from the source branch and makes them part of the destination branch. Use this strategy to keep a detailed, exact history of changes.

This is the default strategy for new projects.

Git command:

git merge --no-ff

Squash

Combines your commits into a single commit when you merge the source branch into the destination branch. Use this strategy to keep a clear and simple history of changes.

Git command:

git merge --squash

Fast forward if possible

Enables a fast-forward merge without creating merge commits when it's possible.

When a fast-forward merge is not possible (when the merged-in history is not a descendant of the current history), a merge commit is created.

For details about fast-forward merging, see the Git documentation.

Git command:

git merge --ff

Back to top

Set the default merge strategy for automatic merges

As an administrator or space owner, you can set the default merge strategy for all automatic merges in a Git repository.

To set the default merge strategy:

  1. From the spaces list at the top right, select a space.

  2. On the Products page, open a Git repository.

  3. In the sidebar, select Settings > Reviewing Changes.

  4. In the Pull Requests section, select the default merge strategy from the list.

  5. Click Save.

PulseUno applies the default merge strategy to all pull requests that are merged automatically.

Back to top

Enable merge strategies

As an administrator or space owner, you can enable merge strategies to let users choose a merge strategy when they merge pull requests.

To enable merge strategies for pull requests:

  1. From the spaces list at the top right, select a space.

  2. On the Products page, open a Git repository.

  3. In the sidebar, select Settings > Reviewing Changes.

  4. In the Pull Requests section, enable merge strategies by selecting them. The default merge strategy is preselected and displayed dimmed.

  5. Click Save.

You can now choose one of the enabled merge strategies when you merge a pull request.

Back to top

See also: