git-branch-synclisted
Install: claude install-skill pivoshenko/pivoshenko.ai
# Sync Branch
Catch current branch up to base. Rebase only. Surface conflicts.
## Flow
1. Parallel:
- `git status --porcelain`
- `git branch --show-current`
- `git rev-parse --abbrev-ref --symbolic-full-name @{u}` (upstream if any)
2. Base: user names one -> verbatim. Else detect: `git symbolic-ref --short refs/remotes/origin/HEAD` -> strip the `origin/`; ref missing -> `git remote set-head origin -a`, re-read; no remote -> `main`, fall back `master`. Why -> rebasing onto `main` in a `develop`-based repo replays the branch onto the wrong parent and manufactures conflicts that aren't real
3. Dirty -> stash: `git stash push -u -m "sync-branch auto-stash"`. Pop later. Unsafe (unresolved merge) -> stop + tell user
4. On base -> `git pull --ff-only origin <base>`. Fails (local base diverged) -> stop + tell user. No auto-rebase of base itself
5. Else:
- `git fetch origin <base>`
- `git rebase origin/<base>`
6. Conflicts:
- `git status` -> list conflicted paths
- Stop + surface. **No** auto-resolve
- Tell user: resolve, `git add <paths>`, `git rebase --continue`. Mention `git rebase --abort` escape
- Leave stash in place. Tell user to pop after resolve
7. Rebase done (clean or aborted) -> pop stash if created
8. Print one-liner: branch, base, commits replayed, force-push needed?
- 0 commits replayed (already up to date) -> say so explicitly; don't mention force-push (nothing rewritten)
## Rules
- Always **rebase**, never merge. Why -> user workflow