Manually resolve conflicts in merge commit on the target branch
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
GitLab resolves merge conflicts by merging the target branch into the source branch before then merging into the target branch. This is often surprising and confusing for users accustomed to the GitHub workflow.
The user expects the resolve of resolving conflicts to be a merge commit in the target branch that resolves the conflicts.
Further details
There are multiple ways to resolve merge conflicts using Git: (1) rebase, (2) resolve the conflicts in the source branch before merging into the target branch, and (3) resolving conflicts in the merge commit that merges the changes from the source branch into the target branch.
GitLab should support resolving conflicts in the merge commit that merges the changes from the source branch into the target branch directly in the GitLab interface. This could be called Resolve conflicts in merge commit
To illustrate the difference between these approaches by way of example, changes have been added to master
that cause our new feature
branch to have conflicts with master
preventing it from being merged.
X feature
/
A---B---C master
There are a couple of ways address this:
-
rebase
feature
branch onmaster
locally, then merge; orY feature / \ A---B---C---o master
-
Resolve conflicts (this could also be done locally too) – merge changes from
master
branch intofeature
branch to resolve the conflicts, then mergefeature
branch intomaster
branch; orX---Z feature / / \ A---B---C---o master
-
Merge locally – locally merge changes from
feature
branch directly in tomaster
and resolve the conflicts in the merge commitX---. feature / \ A---B---C---o master
GitLab's Resolve conflicts feature uses approach number two, which is merging the changes from the target branch back into the source branch, so that a clean merge can occur.
The downside of this is that it creates an additional merge commit.
Proposal
Add support for resolving conflicts using the GitLab interface in the merge commit on the target branch.
Links / references
-
https://help.github.com/articles/resolving-a-merge-conflict-on-github/
GitHub resolves conflicts directly in the merge commit on the target branch