GITHUB Conflict Resolving

Murali Murugesan picture Murali Murugesan · Nov 3, 2012 · Viewed 20.6k times · Source

I am a newbie for github and started using GITHUB for WINDOWS chosen private repositories and shared the same with my colleagues.

Now we are experiencing a problem, not sure how to solve it. We tried google and no use.

Myself and a colleague worked on a same file at a same time, he committed before me. I like to know the changes he made and I want to merge his change with my local file and finally want to commit my version. Is it possible with GITHUB using GITHUB for windows? I have done the same before with Tortoise SVN

I Opened shell command prompt and tried something like

  $ git diff

But it shows only differences and not advised me to merge local with staged version ..

Answer

Simon Boudrias picture Simon Boudrias · Nov 3, 2012

If you press the sync button, you'll be pulling changes your friends made and pushed online. If changes don't merge cleanly, you'll be prompt that a conflict occurred. This will add conflicts line into your files where you'll have to go and resolve them. After that, you'll only need to commit the changes.

The conflicted lines should appear in the Github for Windows interface (although I'm not 100% sure, I actually prefer resolving conflict through the command line).

By command line, you'll have to enter command as so:

git pull
# If merge conflict, you'll be prompt to resolve them, git will list conflicted files
# Open those files in you editor and resolve conflicts. Line will be marked in the files.
# When all is resolved :
git add -A
git commit
# No need to enter a message, git will automatically fill the message with
# merge conflict specific information
git push

In your files, the conflict marker will look something like this:

<<<<<<<<<<< [sha-1 of the commit]
function() {
==================
function( hey ) {
HEAD>>>>>>>>>>>>>