gitgitlabgit-mergegit-merge-conflict

Gitlab says there are merge conflicts, but actually there are none


I created a branch from the master. Made four commits to the branch. After the third commit I created a merge request. Till the third commit, Gitlab never complained about merge conflict. On the fourth commit, it suddenly complained about merge conflict. There have been no changes in the master.

enter image description here

$ git branch
  master
* mylocalbranch

$ git rebase master
  Current branch mylocalbranch is up to date.
    
$ git merge master
  Already up to date.

$ git mergetool
  No files need merging

enter image description here

My merge request is fully approved. I have write access to the repository. The Merge button is greyed out. I am not sure how do I resolve the conflicts that Gitlab is complaining about. Not sure how do I get my code to master.


Solution

  • You are on branch mylocalbranch and you are trying to rebase your local branch on top of master. Well, it already is on top of master, it already is ahead of it and since there are no new commits in the master branch, there is nothing to rebase. Then you are trying to merge master into your local branch, but you are already at the latest changes.

    You have to pull master locally and check if there are any changes in that branch. Once you've pulled master, you have to rebase and would be able to see the conflicts GitLab is talking about. Fix the conflicts and then push again your local branch.