在egit中取消冲突合并 [英] Abort conflicting merge in egit

查看:156
本文介绍了在egit中取消冲突合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在存储库视图中做了一次错误操作,并合并了两个不能(也不应该)合并的提交。结果是合并冲突。



对于这种情况,原生git有 git merge --abort



但是,我无法在egit中找到这样的选项。

解决方案

中止合并


如果合并导致冲突,您可以通过对当前分支进行硬重置来中止合并。这可以在状态冲突和状态合并中完成,即在解决冲突之前和之后。



可以从团队完成硬重置菜单,Git存储库视图或历史视图。有关更多详细信息,请参阅 恢复所有本地和分阶段更改



恢复所有本地和暂存的更改




这可以作为重置的特殊情况来完成。如果你重置为当前的HEAD(通常是你的分支上的最后一个提交),你可以用HEAD的内容覆盖工作树和索引。您可以通过以下三种方式来完成此操作:


  • 选择团队>重置... 在一个项目上。在对话框中选择HEAD或当前分支并切换单选按钮。

  • 右键单击并选择 Reset ... on存储库视图中的任何分支或标签。这会打开一个对话框,让您决定重置类型。在这里选择 hard

  • 在历史视图的HEAD提交中打开上下文菜单,然后选择 Hard Reset


确保您没有任何本地修改:硬重置会丢失。


I recently did a misclick in the repositories view and merged two commits that can't (and shouldn't) be merged. The result was a merge conflict.

Native git has git merge --abort for such cases.

However, i cant find such an option in egit.

解决方案

Check the section "Aborting a merge":

If a merge resulted in conflicts you can abort the merge with a hard reset to the current branch. This can be done in state "Conflicts" and in state "Merged", i.e. before and after you have resolved the conflicts.

The hard reset can be done from the team menu, the Git Repositories View or the History View. See Revert all local and staged changes for more details.

Revert all local and staged changes

This can be done as a special case of reset. If you reset to the current HEAD (normally the last commit on your branch) with the option hard you overwrite the working tree and the index with the content of the HEAD. You can do this in three ways:

  • Select Team > Reset... on a project. In the dialog select HEAD or your current branch and switch the radio button to hard.
  • Right click and select Reset... on any branch or tag in the Repositories view. This opens a dialog which lets you decide on the reset type. Choose hard here.
  • Open the context menu on the HEAD commit in the history view and select Hard Reset.

Make sure you didn't have any local modifications: there would be lost with a hard reset.

这篇关于在egit中取消冲突合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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