home

back

How to Sync a Fork

March 06, 2021

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


Marcus Lyons