Git Conflict Management
Scenario: You have a merge conflict
Unfortunately github can’t handle this in browser.
It is up to the lord of the repository (you) to handle this.
Say you have a pull request from the branch problemBranch
with a merge conflict to master:
Steps to handle:
1) Go to the command line and enter your repo’s directory:
2) Make sure everything is up to date with the github hosted repo:
3) Make a branch to handle the merge conflict:
4) Merge with the master to see problems:
Git ever so kindly automatically modifies the files with conflicts in them to point out where they overlap. (If you want to see a list of the files that have this problem simply run the command git diff --name-only --diff-filter=U
.)
Now head to the file (or files) in question to see the conflict.
Starting at the <<<<<<<
we have the line as it is in the new branch and after the =======
we have the line as it is in the branch we are attempting to merge into, the whole conflict is ended by >>>>>>>
.
At this point you must decide which line to keep (, or include both of them) and edit the text manually.
5) Now merge the conflict free branch to master. You can do this in either the github interface (see previous) or the command line:
6) Revel in the seamlessly modified code.