How to manually resolve a merge conflict in a sqlproj file in Visual Studio/VSTS/Git?

Viewed 16441

I am not very familiar with Git in Visual Studio 2017. I created a new branch from a branch. Made some changes. Pushed the new changes to our repo at visualstudio.com. Created a new pull request and now I am getting the error below. I am not sure what the next step is. If I click on Abandon, I get two options. Reactive or delete source branch. How do I manually resolve this issue? I am trying to find a way to show the conflict inside Visual Studio so I can use the merge tool and edit the conflict. I have no changes showing in VS after I have pushed them to the remote repo. Can't find a way to find out what the cause of the conflict is and how to manually resolve it.

This link shows how to resolve Git conflicts but I have nothing in VS showing any conflicts. The conflict warning is showing on the VSTS website. What's the next step?

enter image description here

3 Answers

Refer to these steps to resolve conflicts:

  1. Open Branches in Team Explorer
  2. Double click the target branch to switch branch (e.g. master)
  3. Right click the target branch=> Pull
  4. Double click the source branch to switch branch (e.g. dev)
  5. Click Merge
  6. Choose master in Merge from branch and choose dev in Into current branch
  7. Click Merge
  8. Click Conflicts link=>Select the file=>Click Merge
  9. Resolve conflicts
  10. Click Commit Merge in Team Explorer
  11. Commit and push dev changes to remote branch
  12. Complete the pull request

In order to see a difference between two branches locally (and being able to resolve a conflict locally), try and fetch first: that will fetch all branches, and update their history.

See "Update code with fetch and pull".

Then you can try a local merge to see and resolve the conflicts: see "Resolve merge conflicts". If you can, rebase your branch on top of the updated target branch locally, then force push (if you are the only one working on said branch): that will update the pull request.
If not, merge the target branch to your branch and resolve the conflicts locally. Then a simple push of the merge commit will be enough.

Just to add Some more precautions to be taken care while resolving the conflicts in Pull Request.

  • Make sure your Target Branch is correct. You have selected some thing different unknowingly(Some times happens, you know which branch you wanna merge but selected master because of daily habit).

  • I was merging trying to resolve my conflict in Visual Studio by Fetching , pulling the Topic and Target branch, then Merged my Topic branch with Target Branch : If did not see any conflict in Visual Studio.

  • But Pull Request was saying Resolve the Conflicts.

After 10-15 mints i have realised my target branch was Wrong.

It can also be in your case, I hope it doesn't happen. Jusr sharing my experience and knowledge.

Related