Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
333 views
in Technique[技术] by (71.8m points)

egit - How to do an "ours" merge using the Eclipse git merge tool?

I'm trying to do a merge where I have conflicts and one file has diverged massively. The eclipse git merge tool is great for small changes, but one of my files is large and has hundreds of explicitly marked conflicting sections. I can't for the life of me find an easy way to just do a merge using the "ours" strategy of just using my version and abandoning the remote version.

On Linux or Mac it would be easy for me to just do it from the command line, but I'm on a corporate Windows computer and don't have command-line git. I even tried the workaround of doing "replace with" -> "Head revision" from the file's context menu in the package explorer, but that action is disabled since the repository is in merge conflict mode. This would be an ok solution, but it would still be preferable to have a clear way of applying "ours" or "theirs" strategies to entire files from the merge tool.

I had to resort to a hard reset, making a copy of my file, doing the merge, and then replacing the merged version with my clean copy. Am I missing a much easier way of doing this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In the editor of the merge tool, you can edit the left section.

After clicking on Merge Tool, select the "HEAD" option in the dialog that appears, then the left section will contain the same content as HEAD.

So when the left section is already good, just make a small modification, undo it and then save. The modification is necessary because save is not available from the beginning.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...