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.
我有一个我的github存储库的贡献者谁有一个分叉并正在分支机构。我想将他们的分支拉到我自己的分支并进行修改,但仍然跟踪他们的。
Can I configure git so that while I'm on branch foo
,
我可以配置git,这样当我在分支foo时,
-
git pull
pulls fromcontributor/foo
and - git pull来自贡献者/ foo和
-
git push
pushes toorigin/foo
- git push推送到origin / 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.
这类似但不同于问题如何使用一个遥控器推送到一个网址并从另一个网址拉出?因为那个问题是要使用相同的远程名称。
1 个解决方案
#1
1
You can set the upstream branch to contributor/foo
您可以将上游分支设置为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
And you can make sure a git push
is always done on origin
:
你可以确保git push始终在origin上完成:
git config remote.pushdefault origin
#1
1
You can set the upstream branch to contributor/foo
您可以将上游分支设置为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
And you can make sure a git push
is always done on origin
:
你可以确保git push始终在origin上完成:
git config remote.pushdefault origin