Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gringoh/85c9649067cd1557346758f511fd4ba6 to your computer and use it in GitHub Desktop.
Save gringoh/85c9649067cd1557346758f511fd4ba6 to your computer and use it in GitHub Desktop.
[Git: Sync forked copy with original] #git

Sync forked copy with original

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches

git fetch upstream

Make sure that you're on your main branch:

git checkout main

Sync your local copy with orignal copy updates

git rebase upstream/main

View all remotes

git remote -v                                                               
origin	YOUR_FORKED_COPY_ADDRESS (fetch)
origin	YOUR_FORKED_COPY_ADDRESS (push)
upstream	ORIGINAL_REPOSITORY_ADDRESS (fetch)
upstream	ORIGINAL_REPOSITORY_ADDRESS (push)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment