First thing you usually see is a message like this when you try and push
:
TBrown02@LZ2626XTBROWN02 MINGW64 /r/conflictdemo2 (master)
$ git push
To https://github.com/tbnorth/conflictdemo.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/tbnorth/conflictdemo.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Ideally there's no conflict of overlapping edits and you can just do:
git pull
git push
which creates a merge commit with an opportunity to edit a default message.
If there is a conflict of overlapping edits you see:
TBrown02@LZ2626XTBROWN02 MINGW64 /r/conflictdemo2 (master)
$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 3 (delta 1), reused 3 (delta 1), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/tbnorth/conflictdemo
eec5ae8..315af09 master -> origin/master
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
And the file will looklike
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
<<<<<<< HEAD
Ut enim, quis nostrud exercitation ad minim veniam ullamco laboris nisi ut
=======
Ut enim ad minim exercitation ullamco laboris veniam, quis nostrud nisi ut
>>>>>>> 315af0986ee84e826f645ebbae76e237f6d6ba11
aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa
qui officia deserunt mollit anim id est laborum.
where the bit between <<<<<<< HEAD and ======= is your version, and the bit between ======= and >>>>>>> 315af098 is their version.
You have to edit the file to fix it as needed.
Then the steps are:
git add foo.R
or whatever the file you just fixed was calledgit commit
to edit a message about the mergegit push
to push the merge
or
git commit -a
to add all changed files and edit a message about the mergegit push
to push the merge