跳到主要内容

Fast-Forward Merge

A fast-forward merge is a method of merging code changes where the changes from the branch being merged are directly applied to the target branch without creating a new merge commit. This type of merge is suitable for the following scenarios:

  • No code conflicts: There are no code conflicts between the target branch and the branch being merged.
  • Simple and linear merge: The commit history of the branch is simple and linear, with no merge commits.

The fast-forward merge feature through Pull Requests can efficiently manage the merging of code changes into the target branch.

How to Perform a Fast-Forward Merge


  1. Ensure Fast-Forward Merge is Enabled (only project administrators can modify):

On the project details page, click on "Project Settings" -> "Pull Requests Settings", and enable "Fast-Forward Merge" in the "Pull Requests - Merge Mode".

image-20241231195726822

No merge commit will be created during the merge operation. Only if the fast-forward conditions are met (meaning all commits in the pull request are based on the latest commit of the target branch) can the merge operation be performed; otherwise, developers will be prompted to perform a rebase operation.

  1. Open the Pull Request to be Merged:

On the project details page, click "Pull Requests" and select the PR to be fast-forward merged.

image-20241231200622836

  1. Confirm Merge Conditions:

Ensure that the PR meets the fast-forward merge conditions, meaning there are no conflicts between the target branch and the Pull Requests branch, and the commit history is linear.

  1. Merge Complete:

Once the merge is complete, the code changes will be directly applied to the target branch without any new merge commits.