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

twitter logo github logo ・1 min read

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)

twitter logo DISCUSS (4)
markdown guide
 

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

 

<<<<<< 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.

 

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...

 

<<<<<<< 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






Classic DEV Post from Mar 2

Which game are you playing right now?

What game are you playing right now? Do you have any favourites from your childhood that you reminisce about?

Hunter Drum profile image
On a mission to build simple versions, of complex things, and complex versions, of simple things

DEV is sort of like Medium, but it's open source and 100% focused on developers.

Now reaching over 3 million visitors per month, it's the fastest growing software development community in the world.

It's free, devoted to the open web, and will never have popups or a pay wall.

Get Started Now