If you find this useful, consider leaving a ⭐ — it helps others discover the project.
branch-watch (bw) is a fast, single-binary CLI tool that tells you — at a glance — whether your GitHub branches are behind main, how far your forks have drifted from upstream, and what pull requests are open. No browser required. Powered by the GitHub REST API.
TL;DR — Run
bw forksto see all your forked repos vs. upstream. Runbw branches owner/repoto see every branch vs. the default branch. Runbw prs owner/repofor open PRs.
Keeping track of GitHub branch and fork sync status manually is tedious:
- You maintain multiple forks of open-source projects and need to know which ones are stale
- Your team has dozens of feature branches and you want to catch the ones that have drifted before they become impossible to merge
- You want to check open PR status without leaving the terminal
branch-watch solves all three with a single command.
- Parallel API calls — fork and branch comparisons now run concurrently; dramatically faster on large repos
- Pagination —
bw forksnow fetches all forks even if you have more than 100 bw branches --base <branch>— compare branches against any branch, not just the defaultbw forks --org <org>— check fork sync status for an entire GitHub organizationbw ignore— hide specific repositories from all output withbw ignore add/remove/list
$ bw forks
Forked repositories
alice/rust rust-lang/rust ↓ 42 behind
alice/tokio tokio-rs/tokio ↓ 7 behind ↑ 2 ahead
alice/serde serde-rs/serde ✓ in sync
acme/axum tokio-rs/axum ↓ 15 behind ↑ 8 ahead
acme/reqwest seanmonstar/reqwest ↑ 3 ahead
Filter to only stale forks:
$ bw forks --behind-only
Forked repositories
alice/rust rust-lang/rust ↓ 42 behind
acme/axum tokio-rs/axum ↓ 15 behind ↑ 8 ahead
alice/tokio tokio-rs/tokio ↓ 7 behind ↑ 2 ahead
$ bw branches owner/repo
→ owner/repo (base: main)
feature/auth ↓ 3 behind ↑ 2 ahead
feat/dashboard ↓ 14 behind
fix/login ✓ up to date
$ bw prs owner/repo
→ owner/repo — 2 open PRs
#101 Add dark mode support
feat/dark-mode → main by @alice · 2 reviewers · opened 2026-03-01
#98 Fix login redirect [draft]
fix/login → main by @bob · opened 2026-04-10
$ bw branches owner/repo --json | jq '.[] | select(.behind > 10)'
{
"branch": "feat/dashboard",
"base": "main",
"behind": 14,
"ahead": 0
}
| Feature | Description |
|---|---|
| Fork sync status | Shows behind/ahead commit count for all your forked repos vs. upstream, sorted by staleness |
| Branch status | Shows every branch vs. the repo's default branch |
| PR overview | Lists open PRs with author, branches, draft status, reviewer count, and open date |
--behind-only filter |
Suppress up-to-date entries; show only what needs attention |
--json output |
Structured JSON for scripting, CI, and jq pipelines |
| gh CLI auto-detection | No bw auth needed if you already use the GitHub CLI |
| GitHub Actions support | Use as a CI step to fail builds on stale branches |
| Multi-platform | macOS (Intel + Apple Silicon), Linux (x86_64 + ARM64) |
| Single binary | No runtime, no dependencies — written in Rust |
| Ignore list | Hide specific repos from all output with bw ignore add |
| Org support | Check fork sync for an entire GitHub org with bw forks --org |
| Custom base branch | Compare branches against any ref, not just the default |
| Token-based auth | Works with GitHub PAT via env var, config file, or gh CLI |
gh extension install nuri-yoo/gh-branch-watch
gh branch-watch forksbrew install nuri-yoo/tap/branch-watchpip install branch-watchnpm install -g branch-watchDownload from the releases page:
| Platform | Binary |
|---|---|
| macOS Apple Silicon (M1/M2/M3/M4/M5) | branch-watch-*-aarch64-apple-darwin.tar.gz |
| macOS Intel | branch-watch-*-x86_64-apple-darwin.tar.gz |
| Linux x86_64 | branch-watch-*-x86_64-unknown-linux-gnu.tar.gz |
| Linux ARM64 | branch-watch-*-aarch64-unknown-linux-gnu.tar.gz |
tar xzf branch-watch-*.tar.gz
sudo mv bw /usr/local/bin/Requires Rust 1.80+.
git clone https://github.com/nuri-yoo/branch-watch
cd branch-watch
cargo install --path .branch-watch uses the GitHub REST API and requires a Personal Access Token (PAT) with repo scope.
Generate a token: github.com/settings/tokens → Generate new token → select repo
Option 1 — gh CLI auto-detection (zero setup):
If you already have the GitHub CLI installed and logged in, bw picks up your token automatically. No extra configuration needed.
gh auth login # one-time setup if not already done
bw forks # works immediatelyOption 2 — Save to config file (persistent):
bw auth ghp_xxxxxxxxxxxxxxxxxxxx
# Saved to ~/.branch-watch.tomlOption 3 — Environment variable:
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
bw forksToken priority: config file → GITHUB_TOKEN env var → gh CLI
Lists all repositories you have forked and compares each one to its upstream default branch. Results are sorted by how many commits behind, worst first.
bw forks
bw forks --behind-only # show only stale forks
bw forks --json # machine-readable output
bw forks --org <org> # check forks in an organization
bw forks --org <org> --behind-only # combine flagsWhen to use: After returning from vacation, before syncing forks, or when maintaining many open-source forks simultaneously.
Shows the sync status of every branch in a repository relative to the default branch (usually main or master). Sorted by commits behind, worst first.
bw branches owner/repo
bw branches owner/repo --behind-only
bw branches owner/repo --base develop # compare against a specific branch
bw branches owner/repo --jsonWhen to use: Before a sprint planning session, during code review, or when cleaning up stale branches.
Lists all open pull requests sorted oldest-first, with author, source → target branch, draft indicator, reviewer count, and open date.
bw prs owner/repo
bw prs owner/repo --jsonWhen to use: Daily standup, PR review sessions, or release preparation.
bw auth <token>Add noisy or irrelevant repositories to an ignore list so they never appear in bw forks or bw branches output.
bw ignore add owner/repo # hide a repository
bw ignore remove owner/repo # unhide a repository
bw ignore list # show all ignored repositoriesbranch-watch is available on the GitHub Marketplace. Add it to any workflow to automatically check branch sync status in CI:
steps:
- uses: nuri-yoo/branch-watch@v1
with:
command: branches # branches | forks | prs
repo: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}Use cases in CI:
- Fail a build if feature branches are more than N commits behind
main - Post a daily Slack summary of fork sync status
- Block merges when a branch is significantly out of date
branch-watch uses semantic versioning. When a v* tag is pushed, the release workflow automatically:
- Builds binaries for all 4 platforms (macOS arm64/x86_64, Linux x86_64/arm64)
- Creates a GitHub Release with attached binaries
- Publishes to PyPI (
pip install branch-watch) - Publishes to npm (
npm install -g branch-watch) - Updates the Homebrew formula with correct SHA256 checksums
To release a new version:
git tag v0.3.0
git push origin v0.3.0Everything else is automated.
How do I check if my GitHub fork is behind upstream?
Run bw forks. It lists every fork in your GitHub account and shows how many commits it is behind or ahead of the upstream repository.
How do I check if a branch is behind main on GitHub?
Run bw branches owner/repo. It compares every branch in the repository against the default branch and shows behind/ahead commit counts.
Do I need to run bw auth if I already use the GitHub CLI?
No. If gh is installed and authenticated, branch-watch detects the token automatically. bw auth is only needed if you don't use the GitHub CLI.
Does branch-watch work with private repositories?
Yes. Any private repository your GitHub token has repo scope access to will work.
Does branch-watch support GitHub Enterprise Server? Not yet. Currently supports github.com only.
What is the difference between branch-watch and git fetch --prune?
git fetch requires a local clone of the repository. branch-watch queries the GitHub API remotely — no local clone needed. It also works across all your repositories at once.
Can I pipe the output to other tools?
Yes. Use --json to get structured output and pipe it to jq, grep, or any other tool.
Does branch-watch support GitLab or Bitbucket? No. branch-watch is built specifically for the GitHub REST API.
Is branch-watch free? Yes. branch-watch is open-source under the MIT license.
branch-watch integrates with the following GitHub REST API endpoints:
| Method | Endpoint | Purpose |
|---|---|---|
GET |
/user/repos?type=fork |
List authenticated user's forked repositories |
GET |
/orgs/{org}/repos?type=fork |
List an organization's forked repositories |
GET |
/repos/{owner}/{repo} |
Fetch repository metadata and upstream parent |
GET |
/repos/{owner}/{repo}/branches |
List all branches |
GET |
/repos/{owner}/{repo}/compare/{base}...{head} |
Get ahead/behind commit counts |
GET |
/repos/{owner}/{repo}/pulls?state=open |
List open pull requests |
MIT © nuri-yoo
