Contents

Clean Up and Sync Your Git Fork

If you want to start with your fork from scratch while remaining the current upstream/main as your base use this.

There is a difference between Syncing a fork and Cleaning up a fork.

Clean up your fork from the command line

1
2
3
4
5
git remote add upstream /url/to/original/repo
git fetch upstream
git checkout main
git reset --hard upstream/main
git push -f

You can also just delete your fork on the web UI and create a new fork.

Syncing a fork from the command line

1
2
3
4
git remote add upstream /url/to/original/repo
git fetch upstream
git checkout main
git merge upstream/main

GitHub You gives you also the opportunity to sync a fork from the web UI.