![](/img/trans.png)
[英]How to update only a particular file from one branch to the other using EGIT in eclipse?
[英]EGit: how to update my branch with other merges
我在 Eclipse 中使用 EGit 進行版本控制。
在 Github 上,假設我通過單擊Fork
按鈕創建我自己的分支來創建一個項目。 然后,我將項目導入 Eclipse:
文件 --> 導入 --> Git --> 來自 Git 的項目 --> 克隆 URI --> ...
然后,我可以根據需要多次編輯項目、提交和推送它。
工作完成后,我發出一個Pull Request
(PR),項目所有者可以merge
我的分支merge
到原始分支。
如果在我的工作期間還有其他成員完成的 PR 和合並,我如何將這些更新添加到我的項目中? 目前,我做的是在我的PR之后刪除我的分支和Eclipse項目, Fork
原始分支以獲得最新版本,然后再次將項目導入Eclipse。
在 Eclipse 中是否有標准/更好的方法來做到這一點? 我正在考慮以下程序:
Fork 分支 --> 導入 --> 編輯代碼 --> 提交和推送 --> 拉取請求和合並 -->從其他合並中獲取內容--> 編輯代碼 --> 提交和推送 ...
在上面,我如何從其他合並中獲取內容? 謝謝。
請不要提供命令行說明。 我需要Eclipse程序。
原來我們需要在 Git 的config
文件中再添加一個倉庫,例如main
倉庫:
[core]
repositoryformatversion = 0
filemode = true
logallrefupdates = true
[remote "origin"]
url = https://github.com/<myUsername>/blog
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "main"]
url = https://github.com/<mainStreamUsername>/blog
fetch = +refs/heads/*:refs/remotes/origin/*
其中, origin
是我自己的倉庫, main
是主流倉庫。
進而,
右鍵project --> Team --> Pull ...(注意:選擇三個點的那個) --> Remote:選擇main
從主流項目中pull。
我們甚至可以使用 Eclipse IDE 更新我們的分支。 按照步驟:
它將提取代碼並為您提供更新的代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.