http://www.cnblogs.com/wavky/p/3504060.htmlhtml
稍微總結下弄了半個下午的egit的merge合併衝突解決方法,網上看的都是一個模板出來的,看的糊里糊塗,花了不少時間去實驗整個合併流程..java
以上三條操做不進行詳細說明,很簡單的。node
打開git repository exploring視圖:git
在Test庫中,在develop分支上打開右鍵菜單,點擊Merge:app
出現衝突提示框:eclipse
返回JAVA工程項目視圖,能夠看見Test工程已經自動進行了部分合並,添加了Develop類,但Test類存在衝突(有紅色雙箭頭標記的文件纔是衝突,茶色星星標記的文件沒有實際衝突項),選中工程打開右鍵菜單,打開Merge Tool:ide
Merge Tool界面顯示以下,左邊爲衝突文件的當前版本(master分支),右邊爲準備合併過來的目標版本(develop分支),手工把右邊的代碼copy到左邊,或至少隨意更改下左邊的文件,保存。 注:右邊的窗口有時候標題顯示的版本節點不正確,多是BUG,或者筆主理解能力不足所致。wordpress
在Merge Tool中更改並保存後,當前衝突的Test類以下圖中的各類神奇標記符號將自動消除:fetch
上圖的紅色神奇符號已經自動合併消除,並呈現相似下圖的合併效果:ui
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, 用以下方法解決.
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:
Here is what would work:
20
In the Git Repositories view:
+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.