gh-fork-synclisted
Install: claude install-skill seansmithworks/agent-skills
# Fork Sync
Sync your fork's main branch with upstream. Shows the gap, confirms the strategy, syncs cleanly.
Triggered by: `/gh-fork-sync`, "sync fork", "sync with upstream", "update fork", "bring fork up to date".
## Steps
### 1. Detect upstream remote
```bash
git remote -v
```
Look for a remote named `upstream` pointing to the original repo. If none exists, prompt:
> No upstream remote found. Add one with:
> `git remote add upstream <original-repo-url>`
> Then re-run this skill.
Don't guess the upstream URL. Exit and wait.
### 2. Show the gap
```bash
git fetch upstream
git log HEAD..upstream/main --oneline | wc -l # commits behind
git log upstream/main..HEAD --oneline # commits unique to fork
```
Present a summary:
```
Fork status vs upstream/main
Behind: 14 commits
Ahead: 3 commits (your changes not in upstream)
Your commits:
a1b2c3d fix: button padding on mobile
e4f5g6h chore: update dependencies
i7j8k9l feat: add user avatar support
```
If already up to date, say so and exit.
### 3. Confirm sync strategy
Default recommendation: **merge** (preserves your fork's commit history, safer for active forks). Offer rebase as an alternative if the user prefers a cleaner history.
> Sync upstream/main into your fork's main?
> Default strategy: merge. Say "rebase" to use rebase instead.
### 4. Sync
For merge:
```bash
git checkout main
git merge upstream/main
```
For rebase:
```bash
git checkout main
git rebase upstream/mai