Fixing merge conflicts?

Posted by user291701 on Stack Overflow See other posts from Stack Overflow or by user291701
Published on 2012-08-28T15:27:34Z Indexed on 2012/08/28 15:38 UTC
Read the original article Hit count: 227

Filed under:

I have two remote branches, "grape" and "master". I'm currently on "grape".

Now I switch to "master":

git checkout master

Now I want to pull all changes from "grape" into "master" - is this the way to do it?:

git merge origin grape

It's my understanding that git will then pull all the current state of the remote branch "grape" into my local copy of "master". It will try to auto-merge for me. If there are conflicts, the files in conflict will have some conflict text actually injected into the file. I then have to go into those files, and delete the chunk I don't want (essentially telling git how to merge these files).

For each file in conflict, do I add and commit the changes again?:

git add problemfile1.txt
git commit -m "Fixed merge conflict."

git add problemfile2.txt
git commit -m "Fixed another merge conflict."

...

after I've fixed all the merge conflicts like above, do I just push to "master" again to finish up the process?:

git push origin master

or is there something else we need to do when we get into this conflict state?

Thank you

© Stack Overflow or respective owner

Related posts about git