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.
git fetch upstream
- Check out the fork’s local default branch ie
git checkout main
- Merge the changes from the upstream default branch ie
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