简体   繁体   中英

Howto recover from bad git merge in Eclipse

Eclipse Jave EE IDE for Web Developers Luna Service Release 2 (4.4.2) Eclipse EGit 3.4.2.201412180340-r

So I am merging between two Git branches in Eclipse, something that I have done dozens of times without incident.

This time, for some reason, conflicts were detected. I'm not sure why. But nothing I do in Eclipse lets me get rid of them. I've used the "merge tool". It let me manually move over all the changes to just the way I wanted it to be. Saved the file, conflict did not go away. Won't let me add to index. Won't let me commit. Tried the Team Synchronizing perspective, with its "Mark as Merged" function. This had no effect, although I remember it fondly from the "bad old svn days".

Many outdated web pages exist which tell me about >>>>> and <<<<< marks. None of these are to be found in my file.

How do I get to the bottom of this? Short of deleting the project from Eclipse and recloning it from the Atlassian stash it remotes to, how can I get out of this catch-22?

Update: answered my own question. see below.

Yup, it's definitely a bug in the eclipse git tooling.

After all this, I came upon Eclipse EGIT - all committed, pulled, merged, marked as merged, still on push I get "rejected - non-fast forward", what am I missing? and tried the solution referenced there . This was partially effective. I went straight to editing the conflicted file, and found the >>>>> and <<<<< marks. I was able to edit and save the file, and when I added it to the index, the marks went away.

But there was still a problem. My file contained both changes that were marked as conflicting and changes not marked as conflicting. When I edited the file directly ONLY the conflicted changes were in the file. The non-problematic changes did not make it into the file. To get those I had to do a manual compare of workspace with branch and move those over.

Sheesh.

So here is what we have.

  1. The "merge tool" is worse than useless for conflict resolution. It strips out the >>>>> marks which makes manual editing difficult. Also, "Team-->Add to Index" doesn't work after you use the merge tool. Don't use it! At least until a fix is released.

  2. Manual editing would work if the non-conflicting changes were added to the file.

Beyond this, there shouldn't have been a conflict anyway. The "conflict" amounted to a blank line vs. a section of new code. If the differencer can't figure that out, that's a problem too.

Oops, from the history view, there is Reset-->Hard Reset. That gets me back to pre-merge. I feel dumb for having posted this question but will leave it up in case someone else hits this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM