I am forking from an existing repository, call it Source. I make my own private repository where I make changes to some files and merge it to my own Github repo. However, every now and then the Source repo makes updates to some of the 'core' files. Is there anyway I can have both my private repo and the original source repo as remote sources and update my local files as the source is updated and push to my private repo as I make changes for my self?
Asked
Active
Viewed 33 times
-1
-
Possible duplicate of [Pull new updates from original GitHub repository into forked GitHub repository](https://stackoverflow.com/questions/3903817/pull-new-updates-from-original-github-repository-into-forked-github-repository) – phd Nov 05 '18 at 11:41
-
https://stackoverflow.com/search?q=%5Bgit%5D+update+forked+repo – phd Nov 05 '18 at 11:41
1 Answers
1
You have a forked
repository and you wish to keep your fork updated with the changes in the source
or upstream
repository.
GitHub has a step-by-step help to pull changes from the original upstream repo here and here.
To sync your fork with the upstream:
- Change the current working directory to your local project
Fetch the branches and their respective commits from the upstream repository. Commits to
master
will be stored in a local branch,upstream/master
$ git fetch upstream
Check out your fork's local master branch.
$ git checkout master
Merge the changes from
upstream/master
into your localmaster
branch. This brings your fork'smaster
branch into sync with the upstream repository, without losing your local changes.$ git merge upstream/master

clamentjohn
- 3,417
- 2
- 18
- 42