skills/git/SKILL.md
Modern git workflows plus dispatched operations (rebase strategy analysis). Use when managing branches, structuring commits, choosing development strategies, or planning a rebase.
npx skillsauth add srnnkls/tropos gitInstall 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.
Current branch:
!git branch --show-current 2>/dev/null
Status:
!git status --short 2>/dev/null | head -10
Dispatches operations and provides reference knowledge for modern git workflows.
Apply these rules to $ARGUMENTS in order:
| Pattern | Route | Action |
|---|---|---|
| rebase (with or without args) | Rebase strategy | Read and follow operations/rebase.md |
| No argument | Knowledge | Use sections below as reference |
Protocol: ../dispatch/protocol.md
When no argument and the user wants an operation rather than reference, use AskUserQuestion:
Header: Git
Question: What would you like to do?
multiSelect: false
Options:
- Rebase: Analyze branch state and recommend a rebase strategy (--onto, autosquash, etc.)
- Reference: Show modern git workflow knowledge below
| Selection | Action | |---|---| | Rebase | Read and follow operations/rebase.md | | Reference | Continue with sections below |
Trunk-based development with short-lived branches, squash merges, and modern git tooling.
Trunk-based with short-lived branches:
main is always deployableBranch naming: <type>/<short-description> (e.g., feat/auth, fix/null-check, chore/deps)
Modern command replacements:
| Legacy | Modern | Why |
|--------|--------|-----|
| git checkout <branch> | git switch <branch> | Dedicated branch switching |
| git checkout -b <branch> | git switch -c <branch> | Explicit create-and-switch |
| git checkout -- <file> | git restore <file> | Dedicated file restoration |
| git checkout HEAD -- <file> | git restore -s HEAD <file> | Restore from specific ref |
| git stash | git stash push -m "msg" | Named stashes with pathspec |
| git push --force | git push --force-with-lease | Prevents overwriting others' work |
| git log -p | git log --remerge-diff | Shows merge conflict resolutions |
Commit hygiene:
git commit --fixup <sha> # Mark as fixup for <sha>
git rebase -i --autosquash main # Auto-fold fixups into targets
Parallel workspaces:
git worktree add ../feat-auth -b feat/auth
git worktree list
git worktree remove ../feat-auth
Performance (large repos):
git maintenance start # Background optimization
git sparse-checkout set src/ # Only checkout what you need
git clone --filter=blob:none # Partial clone (fetch blobs on demand)
Conflict memory:
git config rerere.enabled true # Remember conflict resolutions
When features build on each other, cascade is natural. The discipline is in the rebase.
main: M1 - M2
\
A: A1 - A2 - A3
\
B: B1 - B2
Rule: Rebase downstream branches before the upstream ref changes identity (squash merge, force-push, delete).
# After squash-merging A into main:
git switch B
git rebase --onto main A # Replays B1-B2 onto main, skipping A's commits
# Then delete A
git branch -d A
Merge the chain bottom-up: merge A, rebase B onto main, merge B, rebase C onto main.
See reference/branching.md for details.
| Feature | Since | Use Case |
|---------|-------|----------|
| switch / restore | 2.23 | Replace overloaded checkout |
| --force-with-lease | 2.13 | Safe force push |
| commit --fixup | 2.32+ | Amend past commits without interactive rebase |
| range-diff | 2.19 | Compare rebase before/after |
| worktree | 2.5+ | Parallel branch work without stashing |
| maintenance | 2.29 | Background gc, prefetch, commit-graph |
| sparse-checkout | 2.25 | Large monorepo subset |
| --filter=blob:none | 2.19 | Partial clone |
| blame --ignore-rev | 2.23 | Skip formatting commits in blame |
| diff --color-moved | 2.17 | Distinguish moved vs changed code |
| rerere | old | Reuse recorded merge resolutions |
| log --remerge-diff | 2.35 | Show what a merge actually resolved |
See reference/commands.md and reference/history.md for patterns.
git push --force without --lease (overwrites others' work)checkout for both branch switching and file restoration--fixup + --autosquash)rebase --onto direction — the checked-out branch becomes a descendant of <new-base>, not the other way around. State intent in one sentence ("X will sit on top of Y") before running.git log --oneline --graph <base>..HEAD). A misrouted rebase is recoverable; a squash-merge of a misrouted branch into an integration ref is not.tools
External code-review harness (`peer` zsh tool): canonical model registry, idle-stall watchdog, and self-parallelising fan-out to codex/gemini. Use when dispatching external (non-Claude) reviewers from the review or implement pipelines — call `peer run`/`peer <harness>` instead of `codex exec`/`gcloud`+Vertex directly.
testing
Unified validation dispatcher. Auto-detects validation type from argument or presents selection menu. Routes to test, implement (verify), or hooks-test.
development
Test-driven development methodology (RED-GREEN-REFACTOR). Use when implementing features, fixing bugs, or changing behavior - write failing test first, then minimal code to pass.
development
Create new Claude Code skills following project patterns and best practices. Use when building new skills, extracting reusable capabilities, or converting commands to skills.