git 为什么在 Eclipse 中为 EGit 管理的项目禁用了合并工具?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5934765/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:26:38  来源:igfitidea点击:

Why is the merge tool disabled in Eclipse for a EGit-managed project?

eclipsegitegit

提问by Josh Glover

As per the EGit User Guide, to use the merge tool, one should right-click on the resource with a merge conflict and then select Team> Merge Tool. However, when I do this, the Merge Tool option is greyed out. EGit is properly detecting the conflict and showing me both the icon and text label decorations for the file in conflict.

根据EGit 用户指南,要使用合并工具,应右键单击存在合并冲突的资源,然后选择Team> Merge Tool。但是,当我这样做时,合并工具选项是灰色的。EGit 正在正确检测冲突并向我显示冲突文件的图标和文本标签装饰。

Any ideas?

有任何想法吗?

回答by Meisam

It was disabled for me because I had some changes on my stash list.

它对我来说是禁用的,因为我的存储列表中有一些更改。

$ git stash clear

fixed the problem for me.

为我解决了问题。

回答by VonC

It can depend on the version of EGit you are using, and on the operation that lead to the conflict.
See for instance bug 339092which mention merge tool being not enabled in the case of a conflict after cherry-picking: only the just released EGit 0.12would support that.

它可能取决于您使用的 EGit 版本,以及导致冲突的操作。
例如,参见bug 339092,其中提到在挑选后发生冲突时未启用合并工具:只有刚刚发布的 EGit 0.12会支持这一点。

回答by mohghaderi

It seems to be a bug in EGit as VonC mentioned, but the fix is easy. I did it using reset branch option on the same menu that Cherry Pick option existed. enter image description here

正如 VonC 所提到的,这似乎是 EGit 中的一个错误,但修复很容易。我在 Cherry Pick 选项存在的同一菜单上使用重置分支选项来做到这一点。 在此处输入图片说明

Note: git stash cleardidn't help.

注意:git stash clear没有帮助。

回答by bigT

The only time (other than a bug) that the Merge Tool would be disabled is that when you are in any status other than the Conflicts one; i.e. you will only see that option enabled when the status is Conflicts. The status is shown next to the project name in most views, such as Project Explorer and Synchronize.

合并工具被禁用的唯一时间(除了错误之外)是当您处于冲突以外的任何状态时;即您只会在状态为冲突时看到该选项已启用。在大多数视图中,状态显示在项目名称旁边,例如 Project Explorer 和 Synchronize。

Make sure you have merged with desired branch, then if your merge results in conflicts, your project will enter Conflicts mode, and the Merge Tool will be enabled.

确保您已与所需分支合并,然后如果您的合并导致冲突,您的项目将进入冲突模式,并且将启用合并工具。

回答by Adam

This happens if you tried to push changes to a remote and there were merges required from the remote. It fails with 'not FF' but also simultaneously detects the conflict. Don't ask me why it doesn't mark the whole project as conflicted at this point.

如果您尝试将更改推送到远程并且需要从远程进行合并,则会发生这种情况。它以“not FF”失败,但同时检测到冲突。不要问我为什么在这一点上它没有将整个项目标记为冲突。

Open the Synchronize tab, right-click the project and select 'merge'. This immediately fails because of the conflicting file, and it switches on the conflict icon label for the project and enables the 'merge tool' option.

打开同步选项卡,右键单击项目并选择“合并”。由于文件冲突,这立即失败,它打开项目的冲突图标标签并启用“合并工具”选项。

This is for EGit 4.0.3 in Eclipse Mars.

这适用于 Eclipse Mars 中的 EGit 4.0.3。

回答by user3067860

This also happens if you're in detached head state (in my case, I had checked out a remote branch and then forgotten).

如果您处于分离的头部状态(在我的情况下,我检查了一个远程分支然后忘记了),也会发生这种情况。

Also, even after you've corrected the problem, you may have to select a different project and then reselect the one you actually want (just selecting in the package explorer view) in order for the menu to update.

此外,即使您更正了问题,您也可能必须选择一个不同的项目,然后重新选择您真正想要的项目(只需在包资源管理器视图中选择),以便菜单更新。