简体   繁体   中英

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):

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.

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.

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.

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.

There is a GitHub blog/ help page somewhere stating that is how one updates a fork.

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 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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