Sync the fork by pulling latest main from the upstream remote and pushing to origin.
The upstream remote name defaults to upstream. If $ARGUMENTS is provided, use that instead.
Steps:
- Determine the upstream remote: use
$ARGUMENTSif provided, otherwiseupstream - Verify the remote exists:
git remote get-url <remote>— stop and inform the user if not found - Save the current branch name using
git rev-parse --abbrev-ref HEAD - Run
git checkout main - Run
git pull <remote> main - Run
git push origin main - Checkout the branch saved in step 3