How to do an “ours” merge using the Eclipse git merge tool?

这一生的挚爱 提交于 2020-01-19 11:15:05

问题


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?


回答1:


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.




回答2:


There is now an entry "Replace With" that allows you to select "Ours" or "Theirs" in the context menu for files in the Git Staging view.



来源:https://stackoverflow.com/questions/11674950/how-to-do-an-ours-merge-using-the-eclipse-git-merge-tool

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!