I am new with github and am trying to merge my master and gh-pages branches.
While trying to merge, I had a conflict. Now I get the following message
How do I fix it?
I am new with github and am trying to merge my master and gh-pages branches.
While trying to merge, I had a conflict. Now I get the following message
How do I fix it?
I typically use git mergetool
to resolve conflicts.
It launches the predefined visual merge tool.
Take a look at your current status:
git status
You'll probably see some files which are staged for commit and some which have local changes. The staged ones are those which merged without problem. The ones with local changes have merge conflicts. Open up each of those files, and you'll see something like this somewhere inside:
<<<<< master
// some code that was in master
=====
// some code that was in gh-pages
>>>>> gh-pages
(I think it's something like that anyway)
Edit each of them so they are how you want them to be (ie: fix the conflicts). Then do as it says:
git add the/file/i/fixed.txt
git commit
Basically, try following steps as rule of thumb
git status
If you do not have anything which is not tracked or not committed, you'll something like following
At this point you will have to commit the files
git add-commit -m 'commit message'
You can now merge a branch into current branch or checkout some other branch via
git checkout <branch>
and merge some branch
git merge <branch>
Make sure you have no conflicts and you can successfully merge a branch now.
If you in case have merge conflicts, you will see something like:
You now need to decide on what changes you need to keep to the conflict file, <<<<<<<<<< HEAD
indicates that the change was in parent branch whereas >>>>>>>>>>> refs/heads/new_idea
is what actually was added from the branch you are trying to merge.
You can utilize various merge tools to look at and solve conflicts, for assistance on merge tool have a look at git mergetool
Hope it helps!