问题
I've started Eclipse EGit. In some scenarios it is really not comprehensive.
I have local file e.g. pom.xml changed. On git server this file was changed.
I do pull
, EGIt says:
Checkout conflict with files:
i.e. pulling stops (fetch
is done, but not merge
), that is OK. However the next is bad experience.
I synchronize workspace, put my changes aside and make it the same as FETCH_HEAD. But EGit doesn't want to continue. I replace the file with HEAD revision. But EGit still doesn't want to continue.
What standard expected user operation should be with EGit after conflict resolution?
UPDATE:
I added to index
, then marked as Merged
-> pull
still can't pass.
When I select Merge
I get the dialog

I can't commit the file as it is not in list of changed files.
回答1:
Situation:
- You have local uncommitted changes
- You pull from the master repo
- You get the error "Checkout conflict with files: xy"
Solution:
- Stage and commit (at least) the files xy
- Pull again
- If automerge is possible, everything is ok.
- If not, the pull merges the files and inserts the merge-conflict markers (<<<<<<, >>>>)
- Manually edit the conflicting files
- Commit and push
回答2:
This is the way I solved my problem:
- Right click the folder that has uncommitted changes on your local
- Click Team > Advanced > Assume Unchanged
Pull
from master.
UPDATE:
As Hugo Zuleta rightly pointed out, you should be careful while applying this. He says that it might end up saying the branch is up to date, but the changes aren't shown, resulting in desync from the branch.
回答3:
- After closing the Conflict Error Dialog; from the Project Explorer, right click on the head of the project -> Team -> Stashes -> Stash Changes
- Enter a name for your stash. E.G. "Conflict"
- Try Pulling again. Hopefully there are no errors this time.
- From the Git Repository view, expand your repository -> Stashed Commits
- Right Click on the stash you created in step 2 -> Apply Stashed Changes
- This brings up the merge tool if it can't automatically merge it.
- Manually resolve the merge conflicts in the file/s.
- Right Click on the file editor -> Team -> Add To Index
- If you are not ready to commit the file or just don't want it in the Index, right click on the file editor -> Team -> Remove from Index.
- Cleanup: From the Git Repository view, right Click on the stash you created in step 2 -> Delete Stashed Commit
Your local working directory file should be be merged
回答4:
If error comes for ".settings/language.settings.xml" or any such file you don't need to git.
- Team -> Commit -> Staged filelist, check if unwanted file exists, -> Right click on each-> remove from index.
- From UnStaged filelist, check if unwanted file exists, -> Right click on each-> Ignore.
Now if Staged file list empty, and Unstaged file list all files are marked as Ignored. You can pull. Otherwise, follow other answers.
回答5:
I guess the best way to do this is like this :
- Store all your changes in a separate branch.
- Then do a hard reset on the local master.
- Then merge back your changes from the locally created branch
- Then commit and push your changes.
That how I resolve mine, whenever it happens.
回答6:
After you get from Eclipse the ugly CheckoutConflictException, the Eclipse-Merge Tool button is disabled.
Git need alle your files added to the Index for enable Merging.
So, to merge your Changes and commit them you need to add your files first to the index "Add to Index" and "Commit" them without "Push". Then you should see one pending pull and one pending push request in Eclipse. You see that in one up arrow and one down arrow.
If all conflict Files are in the commit, you can "pull" again. Then you will see something like:
\< < < < < < < HEAD Server Version \======= Local Version > > > > > > > branch 'master' of ....git
Then you either change it by the Merge-Tool, which is now enable or just do the merge by hand direct in the file. In the last step, you have to add the modified files again to the index and "Commit and Push" them.
Checking done!
回答7:
The proper solution is the one provided by @Jojo.Lechelt.
However if you don't want to commit for any reason and still want to pull the changes,you may save your changes somewhere else,replace the conflicting file with HEAD revision and then pull.
Later you can paste your changes again and compare it with HEAD and incorporate other people changes into your file.
回答8:
Right click on the project and select [replace with] -> Head Revision .Now select pull changes in current branch or pull changes from upstream.
来源:https://stackoverflow.com/questions/18050220/eclipse-egit-checkout-conflict-with-files-egit-doesnt-want-to-continue