简体   繁体   English

从原始 repo 更新 github fork

[英]Update github fork from the original repo

I found some way to update fork from the original repo on github (let's say "jay" is name of the original repo's owner):我找到了一些方法来从 github 上的原始 repo 更新 fork(假设“jay”是原始 repo 所有者的名字):

git remote add --track master jay git://github.com/jay/repo_name.git
git fetch jay
git merge jay/master

OK, it works, but after git push git sent huge amount of data and I noticed that I did around 500 commits in the public activity on github, but actually difference between both master branches was around 8 commits.好的,它有效,但是在git push git 发送了大量数据之后,我注意到我在 github 上的公共活动中做了大约 500 次提交,但实际上两个主分支之间的差异大约是 8 次提交。

So what's wrong?那么怎么了?

UPDATE: well, it looks like I lied.更新:嗯,看起来我撒谎了。 Difference was few lines of code, however, author pulled somehow huge bunch of commits.不同之处在于几行代码,然而,作者不知何故拉了一大堆提交。 Maybe it affected only 8 files, that's why I thought 8 commits.也许它只影响了 8 个文件,这就是为什么我认为 8 个提交。

There's nothing wrong.没有什么不对的。 It is a design choice by GitHub that all the changes go via your local machine, so you fetch the upstream remote's commits, and then push them back to your own repo on your own origin remote, which just happens to be on the same server (but different repos), but git didn't 'know' that. GitHub 的一个设计选择是,所有更改都通过您的本地机器进行,因此您获取上游远程的提交,然后将它们推送回您自己的原始远程上的存储库,它恰好位于同一台服务器上(但不同的回购),但 git 不“知道”这一点。

While it would be possible for GitHub to do a direct transfer (assuming a fast forward 'merge') it would have security risks (who has control, and is it fully verified), misunderstanding risks (my remote refs not matching the remote server when I was up to date a moment ago and issued no commands style side effects), and no doubt many others.虽然 GitHub 可以进行直接传输(假设快速向前“合并”),但它会存在安全风险(谁拥有控制权,是否经过充分验证)、误解风险(我的远程引用与远程服务器不匹配时我刚才是最新的并且没有发出任何命令样式的副作用),毫无疑问还有很多其他的。

There is a GitHub blog/ help page somewhere stating that is how one updates a fork.某处有一个 GitHub 博客/帮助页面,说明了更新分叉的方式。

Been trying to resolve this for I while...我一直在努力解决这个问题......

Today I tested a service that automatically updates all your forks from their upstream parent at https://forkrefresh.herokuapp.com/ or selfhosted ( github )今天我在https://forkrefresh.herokuapp.com/或 selfhosted ( github ) 上测试了一项服务,该服务会自动更新来自上游父级的所有分支

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM