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

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


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
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: