Git
Use when main problem is git workflow, not code.
Boundary
Use for:
- safe staging and commit flow
- branch and PR workflow
- rebasing and syncing feature branches
- bisecting regressions
- stashing and worktrees
- tags and release-oriented git ops
Pair with:
skills/cicd/SKILL.mdfor GitHub Actions CI and release automationskills/quality/SKILL.mdwhen bisecting or isolating regressionsskills/docs/SKILL.mdwhen deliverable is release notes or changelog content
Core safety rules
- stage files by name, not
git add .orgit add -A - do not amend unless explicitly asked
- do not push unless explicitly asked
- do not skip hooks with
--no-verify - do not use destructive resets or cleanup commands casually
- do not delete dirty worktree without warning
Common workflow
- inspect working tree
- group changes into logical units
- stage explicitly by file or hunk
- commit with precise conventional message
- verify what remains uncommitted
Use commands/commit.md when task is specifically about preparing commits from current tree.
Branching and PR workflow
Prefer short-lived feature branches and reviewable PRs.
PR checklist:
- title is conventional commit style summary
- description explains WHY
- valid passes for changed surface
- no secrets or unrelated changes included
Draft PRs appropriate for early feedback on incomplete work.
Rebase vs merge
| Scenario | Preferred action |
|---|---|
| update feature branch | git rebase |
| merge completed PR | squash merge |
| preserve explicit history | merge commit |
| isolate regression | git bisect |
Rebase pattern
git checkout feat/my-feature
git fetch origin
git rebase origin/main
If conflicts appear, resolve carefully and continue. Force-push only when explicitly asked and only with --force-with-lease.
Bisect
Use git bisect when regression has known good point:
git bisect start
git bisect bad
git bisect good <commit>
Test each candidate commit until git identifies first bad commit.
Automated form:
git bisect start HEAD <good-commit>
git bisect run uv run pytest tests/path/to/test_file.py -v
git bisect reset
Stash
Stash only when you truly need to park work temporarily:
git stash
git stash -m "description"
git stash list
git stash pop
Prefer worktrees over repeated stashing when you need parallel work.
Tags and release flow
Use annotated tags for releases:
git tag -a v1.2.0 -m "release 1.2.0"
Create tags only after valid passes and only when release intent is clear.
Worktrees
Use worktrees for:
- hotfixes while feature work is in progress
- isolated PR review
- verification without switching branches
- parallel agent work
Read references/worktree.md for full worktree guide.
Useful commands
git status
git diff --stat
git log --oneline -10
git show <commit>
git blame path/to/file.py
git branch -a
git worktree list
Related
commands/commit.md-- prepare clean commits from current treecommands/debug.md-- investigate regressions before usinggit bisectreferences/worktree.md-- worktree patterns and caveats