48

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

enter image description here

I can't commit the file as it is not in list of changed files.

Paul Verest
  • 60,022
  • 51
  • 208
  • 332
  • 2
    Did you do a `Add to Index` via context menu which is something like the `mark as merged` known from CVS/SVN? And afterwards I think you have to do a commit which does perform the merge commit (afaik) when you did `merge` or if you did `rebase` you should do `Rebase > continue` instead of committing, which performs the commit you currently merged and rebases the next if there are even more commits to rebase. – Bertram Nudelbach Aug 05 '13 at 06:07
  • I can't just go out of the state. I took wrong path and EGit is not helping to go out. – Paul Verest Aug 05 '13 at 07:09
  • Yeah okay that dialog is one of my favorites - not ;) Just choose any option, as I am not sure if it matters. But afterwards commit the file and then do the pull. Does that solve the problem? Because then you should be able to solve the conflicts via the merge tool and not see this dialog. – Bertram Nudelbach Aug 05 '13 at 10:38
  • 2
    I made a video where I show how you generally avoid this conflict dialog: http://youtu.be/YjVLGMlHJPk You tried to do that, correct? Then could you post the output of `git status` or show a screenshot of the `git staging view` or both? – Bertram Nudelbach Aug 05 '13 at 20:14

10 Answers10

59

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
Jojo.Lechelt
  • 1,259
  • 12
  • 15
29

This is the way I solved my problem:

  1. Right click the folder that has uncommitted changes on your local
  2. Click Team > Advanced > Assume Unchanged
  3. 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.

Community
  • 1
  • 1
Burak Karakuş
  • 1,368
  • 5
  • 20
  • 43
24
  1. After closing the Conflict Error Dialog; from the Project Explorer, right click on the head of the project -> Team -> Stashes -> Stash Changes
  2. Enter a name for your stash. E.G. "Conflict"
  3. Try Pulling again. Hopefully there are no errors this time.
  4. From the Git Repository view, expand your repository -> Stashed Commits
  5. Right Click on the stash you created in step 2 -> Apply Stashed Changes
  6. This brings up the merge tool if it can't automatically merge it.
  7. Manually resolve the merge conflicts in the file/s.
  8. Right Click on the file editor -> Team -> Add To Index
  9. 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.
  10. 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

jacq_42
  • 3
  • 1
  • 4
Brock W.
  • 249
  • 2
  • 2
  • 4
    after step 5, i've just got message: Problem occured: Apply changes from stashed commit '......' has encountered a problem. Applying stashed commit '....' failed due to 'Applying stashed changes resulted in a conflict' What an unhelpful tool.... no merge dialogs at all. just stupid messages. – razor Sep 20 '16 at 09:10
1

If error comes for ".settings/language.settings.xml" or any such file you don't need to git.

  1. Team -> Commit -> Staged filelist, check if unwanted file exists, -> Right click on each-> remove from index.
  2. 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.

Gururaja Hegde
  • 323
  • 3
  • 9
0

I guess the best way to do this is like this :

  1. Store all your changes in a separate branch.
  2. Then do a hard reset on the local master.
  3. Then merge back your changes from the locally created branch
  4. Then commit and push your changes.

That how I resolve mine, whenever it happens.

Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108
0

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!

0

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.

Zafar Nasim
  • 529
  • 1
  • 6
  • 10
0

Right click on the project and select [replace with] -> Head Revision .Now select pull changes in current branch or pull changes from upstream.

0

In Eclipse :-

  1. Right click -> click on 'add to index'

Add conflict file in staged area

  1. Right Click ->click on commit

Add conflict file in local repository

  1. Pull

You will get all changes (change in remote repository and local repository)

Changes mentioned as Head(<<<<<< HEAD) is your change, Changes mentioned in branch(>>>>>>> branch) is other person change, you can update file accordingly.

  1. Right click ->click on add to index

  2. Right click -> commit and push

Vijay
  • 4,694
  • 1
  • 30
  • 38
0

I have completely different experience with this problem. when I pulled (my staging are were clean!), I saw lot of files in staging after pull, which I didn't changed or added, So I cleaned staging area again by replace with head. After trying pull again I faced same problem again, now this time I did following:

  • stashed changes
  • Close any file open in another program from your repository
  • Try pulling

Hope this solve your issue.

Thanks

Hridaynath
  • 497
  • 5
  • 4