How to Sync a Fork

Syncing a local git repository fork with the upstream main repo.

  • In the working directory of the repository
  • Fetch branches and commits from upstream repo.
    • eg. git fetch upstream
  • Check out the fork’s local default branch ie main
    • git checkout main
  • Merge the changes from the upstream default branch ie upstream/main
    • git merge upstream/main

📝 Note: this only syncs the local copy of the repo, you still have to push to remote if you want to update the repo in VCS

©️ 2023