Archive

Archive for the ‘Git wonders’ Category

Git issue: Your branch and ‘origin/master’ have diverged

February 4, 2014 Leave a comment

So I got to this situation:

Git status says:

mb:tagzbox zucker$ git status
# On branch master
# Your branch and ‘origin/master’ have diverged,
# and have 2 and 1 different commit(s) each, respectively.
#
# Untracked files:
# (use “git add <file>…” to include in what will be committed)
#
# .classpath
# .project
# .settings/
# target/
nothing added to commit but untracked files present (use “git add” to track)

And eclipse has this annoying up and down arrows with numbers (whatever that means):

git issue 1

Now what?  All I want is to get rid of everything local and just start from whatever is on the remote repository.

What finally did it for me was:

git reset --hard origin/master

This removed all local changes (I think) and switched me to the remote repository version.

then when doing

git pull

and

git push

git informed me that all was updated and in sync.  Oh, and the strange arrows are gone as well 🙂

Until the next time…

Advertisements
Categories: Git wonders