Accepted answer

The problem here is remote repository files have been changed(i.e. someone else have changed and pushed the file to the repository which you changed in your local copy) and now you also edited the same.So when you try to push the file it throws an error.
You have to merge the file and then commit the changes and push.

Right click on your project -> Team ->Merge

When you do this it will ask for which branch to merge. Select the branch and proceed to merge.

case 1: If there is no conflict, then merge process will be completed. You can commit and push now.

case 2: In case if there is a conflict egit will show the error message as Conflict and all those files having conflict will be marked with a red icon over the file name on your project explorer.

Right click the files with conflict-> Team -> Merge Tool

This will open the comparision window.Check and merge the changes you want. Once you completed merging

Right click the files with conflict-> Team -> Add to index Commit the changes and Push

Note : You have to commit all your staged files before this merging process.
And to answer your question
"Actually, better question, how do I prevent this?"
This is not an issue, it happens when multiple users are working in a single repository.Whenever you tend to push, before pushing try pulling from the remote repository.When you try to pull egit will say if there is any pending changes or conflicts in remote repository and you solve the conflicts and push.


I met this kind problem by using eGit today. The solution is that you can choose the conflicting file and then Revert commit. Then you can resolve the conflicting file and add to index, commit and push


Right click on conflict file/package and select add to index and commit


Half-way through a pull my Eclipse died. Subsequently I was left in this state.

To resolve, I deleted the index.lock file in the .git folder. I was only then able to do the git merge --abort as suggested elsewhere.


  1. I tried for openshift project problem recommended before: git merge --abort.
  2. I have become to problem “cannot pull into a repository with state: merging_resolved”. Resolved it by: git reset --hard See: "cannot pull into a repository with state: merging_resolved"
  3. Than made: git pull
  4. git commit
  5. To quit VIM editor I have used:<Esc key>:q<Enter key>

    6. git push



This is how I resolved -

1) Right click on project -> Team -> Reset -> [Reset popup will open]
2) By Default Local Repo will be selected -
Reset to: refs/head/master
Reset Type: Mixed (HEAD and index updated)
3) Click on Reset
4) Right click on project -> Team -> Git Pull
5) Right click on project -> Team -> Push to upstream


This is happening because you are in the middle of a merge. Either complete the merge by resolving all conflicts and adding the appropriate files to the index, or abort the merge with git merge --abort. Note that if you do abort the merge, you will most likely get conflicts when you do your git pull, as I assume your previous pull caused conflicts (which is why you were left in the middle of a merge).

Related Query