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 ..
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>>>>>>>>>>>>>
In my case, it just turned out that I neglected to sync a previous commit before attempting to sync the next one.
No conflict resolution necessary.
I also found it interesting that all the difference blocks
<<<<<<<<<<<<<<<<<...
...
======================
...
HEAD>>>>>>>>>>>>>>
are actually placed into your source code. Just open the conflicted file in a text editor and keep/delete the desired branch.