如何在不添加单独遥控器的情况下保持我的前叉同步? [英] How can I keep my fork in sync without adding a separate remote?

查看:13
本文介绍了如何在不添加单独遥控器的情况下保持我的前叉同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设在 GitHub 上有一个存储库 someone/foobar,我将其分叉到 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 ?

目标是:

  • git pull 从父仓库中获取
  • git push 将所有内容发送到我的叉子
  • 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

不过有一个警告:
如果您是唯一一个对前叉进行更改的人,这将是完美的.
但是,如果它与其他人共享,您可能必须从您的分叉中提取,在这种情况下 单独的遥控器 是唯一的解决方案.


实际上,您可以 git pull git@github.com:me/foobar,这消除了警告.
您可以选择哪个更容易记住.


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天全站免登陆