Reputation: 3617
I forked a repository on Github. Now, the original had some update. How can I pull the changes from the original repository and keep sync with them?
And if my source is conflict with the original source, do I have a chance to edit it manually?
EDIT1: Thanks everyone's help. I think I need to RTFM :)
Upvotes: 9
Views: 13498
Reputation: 4507
See github documention on "Syncing A Fork"
https://help.github.com/articles/syncing-a-fork
Ps: Syncing your fork only updates your local copy of the repository; it does not update your repository on GitHub.
Ps 2: The actual code for each step is at the link pasted in the beginning.
Upvotes: 1
Reputation: 171253
What's not stated explicitly in the other two answers is that you can't merge directly from the original project on github to your fork on github, you need to go via a local clone on your own machine.
So you set up the original project as a remote (called upstream
in Magnus Skog and CJlano's answers), then pull from that remote into your local clone, resolving any merge conflicts with your local changes, then push the result to your fork on github.
Upvotes: 9
Reputation: 132978
Just add the original repository as a remote and pull changes from it
git remote add upstream path/to/upstream/repo.git
git pull upstream master
Upvotes: 8
Reputation: 1572
See: https://help.github.com/articles/fork-a-repo
Pull in upstream changes
If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:
git fetch upstream # Fetches any new changes from the original repo git merge upstream/master # Merges any changes fetched into your working files
Upvotes: 6