For each conflict, select
Use ours
or
Use theirs
to mark the version
of the conflicted lines you want to keep. This decision is known as
“resolving the conflict.”
Enter a
Commit message
.
Select
Commit to source branch
.
Resolving conflicts merges the target branch of the merge request into the
source branch, using the version of the text you chose. If the source branch is
feature
and the target branch is
main
, these actions are similar to running
git switch feature; git merge main
locally.
Rebase your branch against the
target branch (here, main) so Git prompts you with the conflicts:
git fetch
git rebase origin/main
Open the conflicting file in your preferred code editor.
Find the conflict block:
It begins with the marker: <<<<<<< HEAD.
Next, it displays your changes.
The marker ======= indicates the end of your changes.
Next, it displays the latest changes in the target branch.
The marker >>>>>>> indicates the end of the conflict.
Edit the file:
Choose which version (before or after =======) you want to keep.
Delete the version you don’t want to keep.
Delete the conflict markers.
Save the file.
Repeat the process for each file that contains conflicts.
Stage your changes in Git:
git add .
Commit your changes:
git commit -m"Fix merge conflicts"
Continue the rebase:
git rebase --continue
Up to this point, you can run git rebase --abort to stop the process.
Git aborts the rebase and rolls back the branch to the state you had before
running git rebase.
After you run git rebase --continue, you cannot abort the rebase.
If you didn't find what you were looking for,
search the docs
.
If you want help with something specific and could use community support,
post on the GitLab forum
.
For problems setting up or using this feature (depending on your GitLab
subscription).