Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resolve conflicts with Git?

I have a pull request for which GitHub tells me "This branch has conflicts that must be resolved." I tried:

~/src/networkx: git rebase origin/master
Current branch topo is up to date.
~/src/networkx: git merge origin/master
Already up-to-date.
like image 867
Neil G Avatar asked Aug 06 '15 18:08

Neil G


2 Answers

Actually... you don't have anymore to pull and rebase locally.
You can resolve (simple) merge conflicts right form GitHub, since Dec. 2016.

See "Resolve simple merge conflicts on GitHub "

You can now resolve simple merge conflicts on GitHub right from your pull requests, saving you a trip to the command line and helping your team merge pull requests faster.

Demonstrating how to resolve a merge conflict

The new feature helps you resolve conflicts caused by competing line changes, like when people make different changes to the same line of the same file on different branches in your Git repository.
You'll still have to resolve other, more complicated conflicts locally on the command line.

like image 76
VonC Avatar answered Sep 21 '22 13:09

VonC


First you need to make sure you have the upstream remote repository set:

git remote add upstream [email protected]:networkx/networkx.git

Then You need to fetch upstream/master and then rebase on that. It's something along the lines of:

git fetch upstream
git checkout <feature-branch>
git rebase upstream/master

As git replays your work on top of upstream/master, conflicts will be raised and you'll have to dive into the files to resolve them. Then you:

git add <files that you fixed>
git rebase --continue
like image 25
Paul H Avatar answered Sep 19 '22 13:09

Paul H