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.
- I tried for openshift project problem recommended before: git merge --abort.
- 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"
- Than made: git pull
- git commit
- 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).
- How do I fix "Cannot pull into a repository with state: MERGING" in EGit?
- How to download/clone a new branch from my server git repository into an already created local git repository in my PC with Eclipse EGit
- EGit: Issuing a fast-forward pull ~ How to configure fetch for a remote repository in EGit
- Cannot fetch or pull from Github with Egit because wrong username is stored
- Cannot clone repository with eGit
- How to fix "The type List is not generic; it cannot be parameterized with arguments <String>" error in cucumber selenium JAVA
- How should I be putting exisiting java projects into a new svn repository to access via eclipse with subclipse?
- Can't clone remote git repository with EGit
- Egit - Cannot checkout now - stuck in rebase state
- How do I go about adding an image into a java project with eclipse?
- How do I create a remote git repository in EGit and link it to an existing Eclipse project?
- How can I fix "Compilation unit name must end with .java, or one of the registered Java-like extensions"?
- Cannot fetch or pull from Github with Eclipse (EGit) because wrong password is stored
- Eclipse egit : How to synchronize with remote repo?
- How to fix the pushing rejected and asked to pull when pulling results in "everything is up to date"?
- How do you successfully use Egit with GitHub?
- Importing with EGit clones repository but doesn't let me import project
- How to import an already checked out svn repository into Eclipse?
- How to fix "Call requires API level 11" with Android Activity?
- How to fix Eclipse ADT Plugin 22.3 / SDK Tools 22.3 with broken properties window?
- Can't add files to my repository with Eclipse EGit
- Jenkins: How do I check out two repository URLs into the same workspace without deleting the first one?
- How to move Egit repository and working directory
- How do I fix UnsupportedCharsetException in Eclipse Kepler/Luna with Jython/PyDev?
- How to checkout a file into previous revision in egit
- How can I fix encoding issues with MySql's JSON and Java?
- Eclipse Egit Cannot Log Into Bitbucket
- How do I fix Eclipse CDT Error "Function 'isdigit' could not be resolved" with Android NDK?
- How do I configure Eclipse to use an existing git repository with existing source code?
- How do I import a Github repository into Nodeclipse (Enide)?
More Query from same tag
- Why can't MANIFEST.MF see packages from Maven's pom?
- Error while keeping .jar file in buildpath of project on 2 laptops
- Eclipse builds very slow
- Android Compat Support Library Linking
- How to load an IFile and modify the same in eclipse plug-in development
- Eclipse Stops Abruptly
- Android video capturing on emulator
- Unable to show graphs in android
- Application screen won't fit to the device
- Eclipse Oxygen causes slowdown the whole system
- plugin development in eclipse
- accessing referenced libraries from packages in eclipse
- eclipse plugin: is it possible to "listen" and interpret double-clicks on text editor?
- OSCPack external library test case in Eclipse project
- Running JUnit Test in Eclipse opens console panel
- P4Eclipse allows me to edit file without checking it out
- Error when opening eclipse with Spring Tools Suite
- Eclipse changes variable on its own during debugging
- ERROR exporting Eclipse Plug-In
- How to write from eclipse's jar to Jmeter's log
- Eclipse "Add unimplemented methods" method ordering
- Apache Tomcat 9 fails to start (eclipse)
- Quick way to change method signature for all methods by adding a parameter in eclipse
- Logcat: "Skipped 33 frames"
- cannot make static reference error in line 42
- Error when starting JBoss Server
- Android debugging issues with eclipse
- Minimize switch case
- Eclipse reverts perspective on startup
- Is it possible to change P4TICKET within P4Eclipse?