我怎么能从一个遥控器拉到另一个使用git? [英] How can I pull from one remote and push to another with git?

查看:146
本文介绍了我怎么能从一个遥控器拉到另一个使用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 from contributor/foo and
  • git push pushes to 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.

推荐答案

您可以将上游分支设置为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆