如何做一个“我们的”使用Eclipse git合并工具合并? [英] How to do an "ours" merge using the Eclipse git merge tool?

查看:282
本文介绍了如何做一个“我们的”使用Eclipse git合并工具合并?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试做一个合并,我有冲突,一个文件大大分歧。 eclipse git合并工具对于小的更改是非常好的,但我的一个文件很大,有数百个明确标记的冲突部分。我不能为我的生活找到一个简单的方法,只是使用我们的我们的战略只是使用我的版本并放弃远程版本合并。

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.

在Linux或Mac上,我可以很容易地从命令行执行,但是我在公司的Windows电脑上,没有命令行的git。我甚至尝试从软件包资源管理器的文件的上下文菜单中进行替换 - >头修订版的解决方法,但该操作被禁用,因为存储库处于合并冲突模式。这将是一个很好的解决方案,但是从合并工具到整个文件应用我们的或他们的策略是一个明确的方法仍然是比较好的。

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?

推荐答案

在合并工具的编辑器中,您可以编辑左侧部分。

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

点击合并工具后,在出现的对话框中选择HEAD选项,左侧部分将包含与HEAD相同的内容。

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.

这篇关于如何做一个“我们的”使用Eclipse git合并工具合并?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆