我怎么能从一个遥控器拉到另一个使用git? [英] How can I pull from one remote and push to another with git?
问题描述
我对我的github仓库有贡献,他有一个fork并且正在分支上工作。我想把他们的分支拉到我自己的分支并进行修改,但仍然跟踪他们。
I have a contributor to my github repository who has a fork and is working on a branch. I want to pull their branch to my own branch and make modifications, but still track theirs.
我可以配置git,以便在分支<$ c $时c> foo ,
Can I configure git so that while I'm on branch foo
,
-
git pull
contributor / foo
和 -
git push 推送至
origin / foo
git pull
pulls fromcontributor/foo
andgit push
pushes toorigin/foo
这与我怎样才能推到一个网址,并从另一个使用一个远程拉?,因为该问题正在寻找使用相同的远程名称。
This is similar to but distinct from the question How can I push to one url and pull from another using one remote? because that question is looking to use the same remote name.
推荐答案
您可以将上游分支设置为contributor / foo
You can set the upstream branch to contributor/foo
git checkout foo
git branch -u foo contributor/foo
假设您有一个远程贡献者
第一个:
That supposes you have a remote contributor
first:
git remote add contributor https://github.com/user/fork_repo
你可以确定一个 git push
总是在 origin
:
And you can make sure a git push
is always done on origin
:
git config remote.pushdefault origin
这篇关于我怎么能从一个遥控器拉到另一个使用git?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!