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
- 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".
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.
- Open the Pull Request to be Merged:
On the project details page, click "Pull Requests" and select the PR to be fast-forward merged.
- 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.
- Merge Complete:
Once the merge is complete, the code changes will be directly applied to the target branch without any new merge commits.