Limbo Exile
Limbo Exile

Reputation: 1351

EGit shows that local repository is ahead and behind the central repository

I had to dive into using Git in a short period of time: so I set up a repository at Bitbucket, configured EGit at home and office. I suppose that as I've only read the first chapters of the Git documentation, so I messed things up quite quickly:

After a few commits and pushes I had a [Master ↑4] label next to the name of my project. I looked up that this means my local master is ahead of the central master by 4 commits. I tried to push the changes to correct this situation but I got a master: master [rejected - non-fast-forward] message without further explanations of what went wrong.

Then I decided to pull the changes with the idea that maybe I have to first get the changes I made on the other workstation before pushing local changes. This resulted in another error:

Fetch Result: No ref to fetch from origin - everything up to date.
Update Result: Failed / Failed Paths - DIRTY_WORKTREE ...

This added a down arrow next to the up arrow and now it says [Master ↑4↓1]

How is it possible to be both ahead and behind of the central repo? How to synchronize all repositories at this point?

Upvotes: 1

Views: 1132

Answers (1)

Limbo Exile
Limbo Exile

Reputation: 1351

What worked for me was:

  1. Manually resolving DIRTY_WORKTREE problems
  2. Committing all the changes
  3. Pulling from the central repo to merge the changes
  4. Pushing everything upstream

I don't know if this is the right workflow but all the arrows have disappeared and the latest version is now on Bitbucket.

Upvotes: 1

Related Questions