Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update github fork from the original repo

Tags:

git

merge

github

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.

like image 484
Misanthrope Avatar asked Jan 01 '13 00:01

Misanthrope


People also ask

How do I update a forked repository in GitHub?

To sync your forked repo with the parent or central repo on GitHub you: Create a pull request on GitHub.com to update your fork of the repository from the original repository, and. Run the git pull command in the terminal to update your local clone.

Can a forked repo pull from original?

A fork is a copy of a repository that you manage. Forks let you make changes to a project without affecting the original repository. You can fetch updates from or submit changes to the original repository with pull requests.

Do GitHub forks get updated?

Tip: Syncing your fork only updates your local copy of the repository. To update your fork on GitHub.com, you must push your changes.


1 Answers

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.

like image 80
Philip Oakley Avatar answered Oct 13 '22 17:10

Philip Oakley