git-sync
Installation
SKILL.md
Git Sync
Sync the current branch with its base or upstream branch. Defaults to merge to preserve history; rebase is opt-in only. Only ever act on what git status and git log actually show: never guess branch state or conflicts.
Workflow
Phase 1: Detect & Decide
Run the following to understand current branch state:
git branch --show-current
git status --porcelain
git remote -v
git log --oneline HEAD..origin/main 2>/dev/null | head -20
git log --oneline origin/main..HEAD 2>/dev/null | head -20
Also check whether the branch is pushed to remote (git log origin/<branch>..HEAD: an error means local-only).