NOTES
Update Git repo from remote
The most common use case for this would be to sync a forked GitHub repo with the repo you forked it from. It is also the same process you would use in a non-Github workflow to keep your repo up-to-date with all the changes in a remote.
The example below assumes that you, want to:
- Name the remote “upstream”
Want to update your main branch to match the remote’s main branch
# 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, # such as upstream/main: git fetch upstream # Make sure that you're on your main branch: git checkout main # Rewrite your main branch so that any commits of yours that # aren't already in upstream/main are replayed on top of that # other branch: git rebase upstream/main