DEV Community

Hunter Drum
Hunter Drum

Posted on

How to "Resolve conflicts" on GitHub pull requests (Solved)

So, I have a repo on GitHub and there is an open pull request. The problem is that I have made commits since the contributor made the pull request. And now the files are conflicting

How do you resolve the conflict? GitHub doesn't explain that at all, not even what these are: "====", ">>>>", "<<<<" (made them shorter)

Top comments (4)

Collapse
 
ben profile image
Ben Halpern

<<<<<< and ====== represent divisions between the existing code and the incoming code.

This is git saying "I can't do this automatically, please help.

One block represents the old code, one the new. You should delete one of the chunks from the code, leaving the other and maybe modifying it, and also delete those divider strings.

Collapse
 
kip13 profile image
kip • Edited

Maybe you need to use rebase to get the commits with previous changes(pull requests) from your repo on github, but maybe this isn't the problem.

If you have conflicts you need to resolve them manually or say to git that resolves throught a merge strategy.

If you trust your changes and you want to set all of them in the repo(positioned in your repo/branch):

git merge -X ours otherbranch

If you dont trust your changes and you want to avoid all of them in the repo(positioned in your repo/branch):

git merge -X theirs otherbranch

But if you want to do this manually, git mergetool can be helpful

Collapse
 
techyogi profile image
Sarah Fernandez • Edited

I use GitKraken which is hooked up to git, and the gui makes it easy to handle merge conflicts. you pull in other peoples changes, and if there's a conflicts, it will tell you and you can pick and choose what you want to resolve the merge conflict. I actually don't know anyone who resolves conflicts without some kind of gui.

the symbols "====", ">>>>", "<<<<" tell you where the head and the conflict is.

I did find this on google, though
rollout.io/blog/resolve-github-mer...

Collapse
 
lancergreg profile image
Roman

<<<<<<< destination:a48f05bd57e26de613a9c6d1035fdb4341f0f30e

                    z => string.IsNullOrEmpty(z.LogicalOperator) ? (LogicalOperator?)null : (LogicalOperator)Enum.Parse(typeof(LogicalOperator), z.LogicalOperator, true))); ;

=======

                    z => string.IsNullOrEmpty(z.LogicalOperator) ? (LogicalOperator?)null : (LogicalOperator)Enum.Parse(typeof(LogicalOperator), z.LogicalOperator, true)));

source:28efba2a88cbb1d26e7d2d2b77507125655ab4d2