-1

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?

NJ.
  • 6,839
  • 1
  • 15
  • 19
  • 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 Answers1

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:

  1. Change the current working directory to your local project
  2. 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

  3. Check out your fork's local master branch.

    $ git checkout master

  4. Merge the changes from upstream/master into your local master branch. This brings your fork's master branch into sync with the upstream repository, without losing your local changes.

    $ git merge upstream/master

clmno
  • 1,864
  • 1
  • 13
  • 22