在EGit中添加额外的远程存储库 [英] Adding an extra remote repository in EGit
问题描述
我有3个不同的git存储库:
I have 3 different git repositories:
- 一个开源项目
- 我自己的fork GitHub上项目的源代码,它是从1分叉的。
- 我的本地存储库是从2复制的。
我在3.上工作,并且可以将更改从2推入/拉出。
I work on 3., and can push/pull changes to/from 2.
但是,现在1.中有更改,我会也喜欢合并到我自己的叉子中。我想我想做的就是将1.中的更改拉到3.中的远程跟踪分支中,在本地进行合并,然后推入2中……这是明智的吗?
However, there are now changes in 1. which I would also like to merge into my own fork. I think what I want to do is pull the changes from 1. into a remote tracking branch in 3., do the merge locally, then push out to 2...... is that sensible?
如果是这样,我如何最好地在EGit中实现这一目标?特别是当它已经配置为从2推入/拉出时,我不确定如何让Egit从1引入更改。
If so, how do I best achieve this in EGit? In particular I'm not sure how I should get Egit to pull in the changes from 1. when it is already configured to push/pull from 2.
推荐答案
不确定在egit中如何执行此操作,但是如果要尝试使用命令行。首先添加一个远程仓库1:
Not sure how to do this in egit, but if you want to try command line. First add a remote for repo 1:
git remote add <remote_name> <url_of_open_source_project>
您现在可以通过输入以下内容来查看远程存储库:
You can now see your remote repos by typing:
git remote -v
创建一个新分支它将用于合并回购的1个代码:
Create a new branch which will be used to merge in repo's 1 code:
git checkout -b <branch_name>
获取仓库1,然后将仓库1的分支合并到您的本地分支中:
Fetch repo 1 and then merge repo 1's branch into your local branch:
git fetch <remote_name>
git merge <remote_name>/<remote's branch_name>
此后,您可以推送到github分支上(假设远程名称为来源
):
After this, you can push onto your github fork (assuming the remote name is origin
):
git push -u origin <github_branch_name>
这篇关于在EGit中添加额外的远程存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!