Skip to content

Instantly share code, notes, and snippets.

@bencat-sixense
Forked from b17z/keeping_repos_in_sync.md
Created February 16, 2024 13:36
Show Gist options
  • Save bencat-sixense/81801e5505f80efe84d3b2ba7575e6cd to your computer and use it in GitHub Desktop.
Save bencat-sixense/81801e5505f80efe84d3b2ba7575e6cd 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