A simple Bash script to mass-sync all your GitHub forks with their upstream repositories entirely server-side using the GitHub API. No local cloning. No disk usage. Fast and repeatable.
- Syncs all forked repositories you own
- Uses GitHub’s native fork sync (server-side)
- No cloning or local git operations
- Safe to re-run anytime
- Works with public and private forks
- Syncs default branch only
- bash shell
- GitHub CLI (
gh) - jq
- Authenticated GitHub CLI session
macOS
brew install gh jqUbuntu / Debian
sudo apt install gh jqFedora
sudo dnf install gh jqgit clone https://github.com/TBadru/sync_forked_repos.git
cd sync_forked_reposgh auth loginchmod +x sync_forked_repos.sh./sync_forked_repos.shThat’s it. All your forks will be synced automatically.
- Only the default branch of each fork is synced
- Uses
--forceto ensure forks exactly match upstream - Any commits on your fork’s default branch will be overwritten
- Feature branches are not affected
- Fetches all repositories you own
- Filters only forked repositories
- Uses
gh repo syncto sync each fork with its upstream - Performs all operations on GitHub, not locally
MIT License.