如何恢复由于与Eclipse和EGit的合并而导致的更改 [英] How to revert changes due to a merge with Eclipse and EGit

查看:777
本文介绍了如何恢复由于与Eclipse和EGit的合并而导致的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse Mars.1(4.5.1)与EGit 4.1.0。



从分支合并到主机后,我无法弄清楚告诉EGit通过简单地保留合并之前的主版本来解决冲突,忽略合并结果导致该文件中的任何内容。



这个是我做的我的Java项目都指向主人。任何项目中没有任何未提交的更改。



在Package Explorer视图中,我右键单击一个项目,单击Team,Merge。



在弹出的合并主对话框中,我选择一个分支(在本地下)中,我在提交上留下合并选项,离开快速选项转发,只更新分支指针。



点击合并。 合并结果对话框弹出并显示结果冲突。公平的,我期待着冲突,我会一个一个地手动解决他们。



现在我的问题是,一些文件冲突的方式我想解决冲突是简单地拒绝从合并导致的该文件的任何更改;只是保持该文件,因为它是在合并之前。
这应该是微不足道的(至少在SVN中),但是我看不到Eclipse中的任何地方怎么做。合并已将文件填入<<<<<冲突标记,我只是没有看到需要做什么来恢复这些更改只有在该文件,以便该文件简单地变得相对于主人,这是所有的项目是指向的地方。



如果我在同步视图中右键单击该文件,并选择覆盖,则会询问我是否要覆盖本地更改。这正是我想要的,我希望文件没有本地的更改,所以我单击是。但是结果是文件在本地被删除,尽管它在master和branch都存在。它从包资源管理器中消失,并且由于我也在编辑器中打开它,该编辑器标签关闭。这不是我的意思是覆盖本地的变化,我不明白为什么会发生。



如果不是覆盖,我选择标记为合并虽然冲突标记仍然存在),但是文件不再显示为冲突,但它仍然具有所有的冲突标记,当然仍然显示为已更改,而我希望它相对于主而不变。



如果我解决了其他文件中的所有冲突,并且我想提交除有问题的所有文件之外的所有文件,以便保持不变 - 当提交对话框显示并列出要提交的所有文件,每个都有一个复选框,我点击有问题的文件的复选框将其从提交中排除,该复选框不会被取消选中,这适用于任何其他文件;复选框不会被禁用,但是它们没有响应点击。



我缺少什么?

解决方案

截至目前为止,只有在EGit分段视图中的冲突文件可以使用我们的/他们的文件


I am using Eclipse Mars.1 (4.5.1) with EGit 4.1.0.

After a merge from a branch into master, I cannot figure out how to tell EGit to resolve a conflict by simply keeping the version that was in master before the merge, ignoring anything that came into that file as a result of the merge.

This is what I do. My Java projects all point to master. No uncommitted changes in any project.

In Package Explorer view I right-click a project, click Team, Merge.

In the "Merge 'master'" dialog that pops up I select a branch (under "Local"), I leave the "Merge options" on "Commit" and the "Fast forward options" on "If a fast-forward, only update the branch pointer".

I click "Merge". The "Merge Result" dialog pops up and says "Result Conflicting". Fair enough, I was expecting conflicts and I'm going to resolve them manually one by one.

Now, my problem is that for some of the files in conflict the way I want to resolve the conflict is simply to reject any change to that file resulting from the merge; just keep that file as it was before I did the merge. This should be trivial to do (at least in SVN it was), but I cannot see anywhere in Eclipse how to do that. The merge has filled the file with the "<<<<<<" conflict markers and I just don't see what needs to be done to revert those changes only in that file so that that file simply becomes unchanged with respect to master, which is where all the projects are pointed.

If I right-click on the file in the Synchronize view and select "Overwrite", I am asked if I "want to overwrite local changes". That's exactly what I want, I want the file to have no local changes, so I click Yes. But the result is that the file gets deleted locally, although it exists both in master and in the branch. It disappears from Package Explorer, and since I also had it open in the editor, that editor tab closes away. That's not what I meant by "overwrite local changes" and I don't understand why it happens.

If instead of "Overwrite" I select "Mark as merged" (although the conflict markers are still there), the file is no longer shown as in conflict, but it still has all the conflict markers in it and of course is still shown as changed, while I want it to be unchanged with respect to master.

And if instead I resolve all the conflicts in the other files and I want to commit all the files except the problematic one - so that that one will stay unchanged - when the commit dialog shows up and lists all the files to be committed, each with a checkbox, and I click on the checkbox of the problematic file to exclude it from the commit, the checkbox doesn't get unchecked, and this goes for any of the other files; the checkboxes don't look disabled, but they don't respond to the click.

What am I missing ?

解决方案

As of now checkout ours/theirs is available on conflicting files in the EGit staging view only

这篇关于如何恢复由于与Eclipse和EGit的合并而导致的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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