Monday, 3 August 2015

Resolving git conflicts...

I'm trying to sync my Electives Map from my home computer to my work computer.
However, this has identified a conflict.
I need to raise my game and work out what to do with conflicts in Github.
I'm currently working in the terminal using command prompt.
Here are the results when I typed git status and then git pull.

m095:AptanaElectives2014 paulbrennan$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#   (use "git push" to publish your local commits)
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# data/barplot_low_20140827
# pictures/lowpoints20140827.png
nothing added to commit but untracked files present (use "git add" to track)


m095:AptanaElectives2014 paulbrennan$ git pull
remote: Counting objects: 45, done.
remote: Total 45 (delta 21), reused 21 (delta 21), pack-reused 24
Unpacking objects: 100% (45/45), done.
From https://github.com/brennanpincardiff/Electives2014
   638c11b..3e7d41f  master     -> origin/master
Auto-merging futureops.html
CONFLICT (content): Merge conflict in futureops.html
Automatic merge failed; fix conflicts and then commit the result.

There is a conflict in the futureops.html file. If I go to the file then there the conflict is marked with this kind of text:

<<<<<<< HEAD
CONFLICT
>>>>>>> upstream/unmergeable-branch

To fix the conflicts, make the necessary changes. Then add and commit the new file using the commands below.

git add filename
git commit -m "fixed conflict"

Let's check if everything looks OK:

git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean

Need to push these to the external repository.

git push

Check status again:
m095:AptanaElectives2014 paulbrennan$ git status
# On branch master
nothing to commit, working directory clean

All done!
Ready to code again.

No comments:

Post a Comment