我怎样才能保持我的叉同步,而无需添加单独的远程? [英] How can I keep my fork in sync without adding a separate remote?

查看:93
本文介绍了我怎样才能保持我的叉同步,而无需添加单独的远程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在GitHub上有一个 someone / foobar 的仓库,我把它分配给 me / foobar



如何将将新提交从父存储库直接拖放到我的叉,而无需添加一个单独的远程服务器并记得定期从那里 <? / p>

目标是:


  • git pull 从父存储库获取

  • git push 将所有内容发送到我的分支


解决方案

  git remote set-url origin git@github.com:someone / foob​​ar 
git remote set-url origin --push git@github.com:me / foobar

尽管有一点需要注意:

如果您是唯一一个对您的分支进行更改的人,这非常完美。

但是,如果是与其他人共享,你可能不得不从你的分叉拉,在这种情况下,一个单独的远程是唯一的解决方案。



编辑:

实际上,您可以 git pull git@github.com:me / foobar ,它可以消除警告。

您的选择更容易记住。


Let's assume there is a repository someone/foobar on GitHub, which I forked to me/foobar.

How do I pull new commits from the parent repository directly to my fork, without having to add a separate remote and remember to pull regularly from there ?

The goal is to:

  • git pull to fetch from the parent repository
  • git push to send everything to my fork

解决方案

git remote set-url origin git@github.com:someone/foobar
git remote set-url origin --push git@github.com:me/foobar

There is one caveat though:
This is perfect if you are the only one making changes to your fork.
However, if it is shared with other people, you may have to pull from your fork, in which case a separate remote is the only solution.

Edit:
Actually, you can git pull git@github.com:me/foobar, which removes the caveat.
The choice is yours as to which is easier to remember.

这篇关于我怎样才能保持我的叉同步,而无需添加单独的远程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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