Update a forked Repository
Remarks#
- GitHub Help: Configuring a remote for a fork
- GitHub Help: Syncing a fork
- popular ans in StackOverFlow
Config a remote for your fork then sync your fork (master branch)
- Config a remote for my fork
$ cd my_local_repo
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
# Specify a new remote upstream repository that will be synced with the fork
$ git remote -v
# Verify the new upstream repository specified for my fork
- Sync my fork locally
$ cd my_local_repo
$ git fetch upstream
# Fetch the branches and their respective commits from the upstream repository
# Commits to master will be stored in a local branch, upstream/master
$ git checkout master
$ git merge upstream/master
# Merge the changes from upstream/master into your local master branch
# brings your fork's master branch into sync with the upstream repo
- Sync my fork on Github
$ git push origin master