Skip to content

Instantly share code, notes, and snippets.

@b17z
Created January 16, 2019 14:17
Show Gist options
  • Save b17z/7100368256837639701d2431b3e57d8c to your computer and use it in GitHub Desktop.
Save b17z/7100368256837639701d2431b3e57d8c to your computer and use it in GitHub Desktop.
Keeping Downstream Repository In Sync with Upstream Repository

When contributing to a specific repository, you will clone it. That's your little playground now to experiment. But your changes and your repo itself will not be synced up to the main repository you forked from. Here's how to keep it up to date while experimenting with your changes.

  1. Create a remote in your forked/cloned repository pointing to the main repository
git remote add upstream [URL of main repository you forked from]
  1. Fetch the upstream changes
git fetch upstream
  1. Merge upstream changes with your forked/cloned repository
git merge upstream/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment