http://www.cnblogs.com/wavky/p/3504060.html

稍微总结下弄了半个下午的egit的merge合并冲突解决方法,网上看的都是一个模板出来的,看的糊里糊涂,花了很多时间去实验整个合并流程..

前提工作

  • 创建一个普通JAVA工程Test,创建一个类Test,写点东西并加入到本地git库;
  • 创建个develop分支,创建个Develop类,修改Test类的某些语句,添加新代码段,提交;
  • 切换到master分支,创建个Master类,修改Test类的同一部分语句,提交;

以上三条操作不进行详细说明,很简单的。

合并过程

打开git repository exploring视图:

在Test库中,在develop分支上打开右键菜单,点击Merge:

出现冲突提示框:

返回JAVA工程项目视图,可以看见Test工程已经自动进行了部分合并,添加了Develop类,但Test类存在冲突(有红色双箭头标记的文件才是冲突,茶色星星标记的文件没有实际冲突项),选中工程打开右键菜单,打开Merge Tool:

Merge Tool界面显示如下,左边为冲突文件的当前版本(master分支),右边为准备合并过来的目标版本(develop分支),手工把右边的代码copy到左边,或至少随意更改下左边的文件,保存。   注:右边的窗口有时候标题显示的版本节点不正确,可能是BUG,或者笔主理解能力不足所致。

在Merge Tool中更改并保存后,当前冲突的Test类如下图中的各种神奇标记符号将自动消除:

上图的红色神奇符号已经自动合并消除,并呈现类似下图的合并效果:

Window->Show View->Other,打开Git Staging视图:

Git Staging视图中,Unstaged Changes部分包含冲突文件(包括手工合并前后),Staged Changes部分包含已经完成自动合并的文件,在已经合并完成的冲突文件Test.java上打开右键菜单,选中Add to Git Index:

Test.java被添加到Staged Changes下面,并自动生成Commit Message等内容,确认无误后点击Commit提交:

至此,Merge合并的冲突已经完全解决,从develop到master方向的合并已经完成:

若要从master合并到develop,只需切换到develop分支,(在git repository exploring视图中)在master菜单上点击Merge即可。笔主使用的Egit2.2版本默认进行Fast-Forward方式的合并,最新的3.2版已经提供是否选择Fast-Forward的UI窗口。

* 关于Egit3.2的Fast-Forward合并:提供该选择的UI窗口仅在JAVA视图窗口中,通过项目工程右键菜单中执行Team->Merge触发显示,通过上面使用git repository exploring视图简单调用Merge的方式仍然使用默认的Fast-Forward合并:

==============================================

https://allaboutmynonexistedworld.wordpress.com/2014/02/05/eclipse-git-merging-branch-to-master/

1. Make sure the current pointer is at master.

2. Right click on the project to be merged. Select Team -> Merge

3. In the pop up window, double click on the branch you want to merge.

4. A merge conflict window should jump up. Click OK to continue

5. Right click on the project with a red mark. Select Team -> Merge Tool

6. In “Select a Merge Mode” window, select Use HEAD option and hit OK

7. Edit it in the editor however you want (play around with the options)

8. Once you decided the conflict is resolved, right click on the red mark file, select Team -> Add to Index

9. Finally, you should be able to commit the changes and push to the upstream.

===========================

Problem resolve “egit remote tracking show nothing”

有时候在用Team => Switch to => 时, 看不到想要的branch, 用如下方法解决.

https://stackoverflow.com/questions/47390703/how-do-i-get-a-new-branch-to-show-up-in-eclipse-git-remote-tracking?rq=1

How do I get a new branch to show up in Eclipse Git Remote Tracking?

I have an existing Eclipse git project, with a master and development branch present in both local, and remote tracking. I have just added a new branch in my git repository, but I can't figure out how to get it to show up in Eclipse.

I have tried to read up on the subject, but it seems like it is just expected to automatically show up. I have found a lot of similar questions, but they all seem to deal with the issues of a completely empty remote tracking folder, instead of my problem of only a single new branch missing. I already have Master and Develop present.

Here is what does not work:

  • Clicking refresh in the Git repositories window.
  • Any kind of synchronize, pull or other update I can find

Here is what would work:

  • Right clicking the remote tracking folder, and selecting "Paste repository path or URI". If I do that, and select the exact same path as is already there, I can see my new branch. This action does require that I completely clone the whole repository to an empty folder again, and that can't be how this is intended to work.
  • I believe it might work to use some kind of command line tool, but I really want an Eclipse solution to this, as I feel sure it exists, and I am just missing something.

20

In the Git Repositories view:

  1. Right-click the repository and choose Fetch from Upstream
  2. If the new branch will not shown up below Branches/Remote Tracking, you have to configure fetch:
    1. Right-click the fetch node below Remotes/origin and choose Configure Fetch...
    2. In the Configure Fetch make sure there is only the single Ref mapping +refs/heads/*:refs/remotes/origin/*:

God damnit, in my latest attempts, I
just confused two different repositories. So this really does work. Thanks a
lot! – KjetilNordin Nov
20 '17 at 11:56

add a comment

在执行了一次上面的fetch后,  在用Team => Switch to => 时, 可以看到了branch.

Eclipse的Git插件Egit: merge合并冲突具体解决方法的更多相关文章

  1. Egit的merge合并冲突具体解决方法

    稍微总结下弄了半个下午的egit的merge合并冲突解决方法,网上看的都是一个模板出来的,看的糊里糊涂,花了很多时间去实验整个合并流程.. 前提工作 创建一个普通JAVA工程Test,创建一个类Tes ...

  2. Eclipse上GIT插件EGIT使用手册

    http://blog.csdn.net/luckarecs/article/details/7427605 Eclipse上GIT插件EGIT使用手册   一_安装EGIT插件 http://dow ...

  3. Eclipse上GIT插件EGIT使用手册ᄃ

    Eclipse上GIT插件EGIT使用手册 一_安装EGIT插件 http://download.eclipse.org/egit/updates/ 或者使用Eclipse Marketplace,搜 ...

  4. git pull的时候发生冲突的解决方法之“error: Your local changes to the following files would be overwritten by merge”

    今天在使用git pull 命令的时候发生了以下报错 目前git的报错提示已经相关友好了,可以直观的发现,这里可以通过commit的方式解决这个冲突问题,但还是想看看其他大佬是怎么解决这类问题的 在网 ...

  5. Eclipse上GIT插件EGIT使用

    一.安装EGit插件 參考:MyEclipse8.5整合Git 二.EGit配置 配置个人信息 Window > Preferences > Team > Git > Conf ...

  6. Eclipse上安装GIT插件EGit及使用

    一.Eclipse上安装GIT插件EGit Eclipse的版本eclipse-java-helios-SR2-win32.zip(在Eclipse3.3版本找不到对应的 EGit插件,无法安装) E ...

  7. Eclipse上安装GIT插件EGit

    一.Eclipse上安装GIT插件EGit Eclipse的版本eclipse-java-helios-SR2-win32.zip(在Eclipse3.3版本找不到对应的 EGit插件,无法安装) E ...

  8. 【转】Eclipse上安装GIT插件EGit及使用

    http://yufenfei.iteye.com/blog/1750124 一.Eclipse上安装GIT插件EGit Eclipse的版本eclipse-java-helios-SR2-win32 ...

  9. 转:Eclipse上安装GIT插件EGit及使用

    一.Eclipse上安装GIT插件EGit Eclipse的版本eclipse-java-helios-SR2-win32.zip(在Eclipse3.3版本找不到对应的 EGit插件,无法安装) E ...

随机推荐

  1. Java连载60-类之间的六种关系

    一.类之间的关系 1.泛化关系(UML图:实线空心三角形箭头,箭头指向被继承方) 类和类.接口与接口之间的继承称为泛化关系 public class A {} class B extends A{} ...

  2. PCA主成分分析(最大投影方差)

    PCA简介: 从n维数据中提取最能代表这组数据的m个向量,也就是对数据进行降维(n->m),提取特征. 目标: 找到一个向量\(\mu\),使n个点在其上的投影的方差最大(投影后的数据越不集中, ...

  3. 可编程实验板EPM1270T144C5蜂鸣器音调频率选择

    always@(tone) begin case(tone) 'd1 : time_end=10'd1911 ;//L1 'd2 : time_end=10'd1702 ;//L2 'd3 : tim ...

  4. python高阶函数——sorted排序算法

    python 内置的sorted()函数可以对一个list进行排序: >>> sorted([8,3,8,11,-2]) [-2, 3, 8, 8, 11] 既然说是高阶函数,那么它 ...

  5. Python真牛逼,获取压缩文件密码,我只要一分钟!

    事情的经过是这样的: 又是奶茶,行吧行吧. 快点开工,争取李大伟回来之前搞定. 李大伟说是6位数字密码 那么我们可以利用python生成全部的六位数字密码 这样,我们就生成了一个从000000到999 ...

  6. python3读取图像并可视化的方法(PIL/Pillow、opencv/cv2)

    原图: 使用TensorFlow做图像处理的时候,会对图像进行一些可视化的操作.下面,就来列举一些我知道的图像读取并可视化的方法. 1. Pillow模块 1.1 Pillow模块的前生 Pillow ...

  7. MyBatis映射文件 相关操作

    一.MyBatis映射文件 1.简介 MyBatis 的真正强大在于它的映射语句,也是它的魔力所在.由于它的异常强大,映射器的 XML 文件就显得相对简单.如果拿它跟具有相同功能的 JDBC 代码进行 ...

  8. document.write() 为什么会清空页面

    很久以前遇到的问题,放着放着就忘记去研究了最近看到一篇文章总结一下作者:abloumeurl:   http://blog.csdn.net/u013451157/article/details/78 ...

  9. RU/RUR的安装

    RU/RUR的安装方法是仍然使用现有的Opatch技术来安装RU/RUR. 更多常见问题,请参考文档: Release Update and Release Update Revisions for ...

  10. Excel上下标如何设置?

    Excel表格怎么设置上下标?Excel上下标设置技巧 在21世纪的我们,平时的工作和学习中,经常会使用到一些专业的文档,比如方程式.数据的公式和科学计数等,其中均会涉及到许多的上下标符号输入以及使用 ...