skills/git-sync/SKILL.md
Sync current branch with base branch using merge (default) or rebase. Handles fork sync, conflict detection, and stash management.
npx skillsauth add mgiovani/cc-arsenal git-syncInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Cross-Platform AI Agent Skill This skill works with any AI agent platform that supports the skills.sh standard.
Sync the current branch with its base or upstream branch. Defaults to merge to preserve history; rebase is opt-in only.
CRITICAL: Only sync based on what git status and git log actually show:
git status and git branch before any sync operationRun the following to understand current branch state:
# Current branch and status
git branch --show-current
git status --porcelain
# Remote tracking info
git remote -v
git fetch --dry-run 2>&1 || true
# Commits ahead/behind base
git log --oneline HEAD..origin/main 2>/dev/null | head -20
git log --oneline origin/main..HEAD 2>/dev/null | head -20
Also check:
git log origin/<branch>..HEAD — if error, branch is local-only)gh pr view --json baseRefName -q .baseRefName 2>/dev/null or ask user)Determine sync strategy:
Merge (default) — Use when:
--rebaseRebase (opt-in) — Use only when:
--rebase, OR--rebase is passedFork sync (--upstream) — Use when:
git fetch upstream && git merge upstream/<base>Display the detected state and proposed strategy clearly before proceeding:
Current branch: feature/my-feature
Base branch: main
Strategy: merge (default)
Commits behind: 5
Commits ahead: 2
Dirty tree: no
If user did not provide --base, infer base from:
gh pr view --json baseRefName (if GitHub CLI available)git config branch.<name>.mergeAskUserQuestionHandle dirty working tree:
--stash flag: run git stash push -m "git-sync auto-stash" before sync--stash: abort with clear message asking user to commit, stash, or use --stashFetch latest from remote:
git fetch origin
# For fork sync:
git fetch upstream
Re-check divergence after fetch to report accurate numbers
Merge strategy:
git merge origin/<base>
Rebase strategy (local-only branch):
git rebase origin/<base>
Rebase strategy (pushed branch — warn user first):
WARNING: This branch has been pushed to remote.
Rebasing will require a force-push, which rewrites history.
This is ONLY safe if no one else has pulled this branch.
Proceed? [y/N]
If yes:
git rebase origin/<base>
git push --force-with-lease origin <branch>
On merge/rebase conflict:
git diff --name-only --diff-filter=U to list conflicting filesgit merge --continue or git rebase --continuegit merge --abort or git rebase --abortAfter successful sync:
# Show new position
git log --oneline -5
git log --oneline origin/<base>..HEAD | wc -l
Report:
git stash pop if --stash was used)git rerere if conflicts were presentPop stash if it was auto-stashed:
git stash pop
--rebase: Use rebase instead of merge--base <branch>: Specify the base branch (default: auto-detect)--upstream: Sync from upstream remote instead of origin (fork workflow)--stash: Auto-stash dirty changes before sync, pop after--force-with-lease instead of --force to prevent overwriting others' workupstream remote to be configured (git remote add upstream <url>)# Sync with main using merge (default)
/git-sync
# Sync with develop branch
/git-sync --base develop
# Rebase onto main (local-only branch)
/git-sync --rebase
# Sync, stashing local changes first
/git-sync --stash
# Fork sync: pull upstream changes into your fork
/git-sync --upstream --base main
development
Generate comprehensive test suites with coverage analysis and parallel test writing. Automatically activates when users want to write tests, add test coverage, generate test cases, improve testing, or analyze coverage gaps. Supports pytest, vitest, jest, and all major test frameworks.
development
Multi-agent PR review team orchestration with 7 specialized reviewers for security-sensitive or architectural PRs. Spawns architecture, security, performance, testing, style, docs/UX, and adversary reviewers as a coordinated team. Premium review for critical code changes.
development
Spec-driven team orchestration: adaptive development team scaling from 3 to 11 agents based on complexity.
development
Perform comprehensive security review targeting OWASP Top 10 2025 vulnerabilities for PRs, commits, or entire codebases. This skill should be used when a user wants to audit code security, scan for vulnerabilities, review security posture, or check for OWASP compliance. Analysis only - identifies vulnerabilities without modifying code.