| name | git-master |
| description | Commit and release hygiene for safe version-control work. |
| origin | pi-crew |
| triggers | ["commit this","tag release","bump version","publish package","prepare release"] |
git-master
Use this skill for commit/release hygiene. This skill covers git workflow from local changes to published releases.
Pre-commit Checklist
Before every commit:
- Run
git status --short — understand what changed
- Stage only files related to the current task
- Review staged diff with
git diff --staged
- Check for unintended changes (generated files, temp files, secrets)
- Ensure tests pass locally before committing
Commit Rules
- Independent commits: Each commit should be self-contained and revertible. Don't mix unrelated changes.
- Concise messages: Use imperative mood, 50 chars or less for subject. Add body for context.
- Format:
type(scope): subject where type is fix, feat, chore, docs, test, refactor
- Do not include: secrets, OTPs, local temp files,
node_modules, dist/, *.log, *.tmp
- Do not push/publish unless explicitly requested
- Verify before staging large generated files (tarballs, build outputs)
Commit Message Format
type(scope): short description (50 chars max)
Longer description if needed. Explain WHY the change was made,
not just what changed. Reference issues/PRs if applicable.
Refs: #123
Examples:
fix(live-agent): prevent cross-workspace agent access
feat(widget): add snapshot cache with 500ms TTL
docs(skills): add event-log-tracing skill
chore(tests): add integration test for reconcileAllStaleRuns
Branch Naming
| Pattern | Use case | Example |
|---|
fix/<description> | Bug fixes | fix/ghost-run-display |
feat/<description> | New features | feat/skill-templates |
docs/<description> | Documentation | docs/skills-deep-research |
chore/<description> | Tooling, CI | chore/update-ci-node22 |
hotfix/<description> | Urgent production fixes | hotfix/secret-leak |
Rollback Procedures
Revert last commit (safe, keeps history)
git revert HEAD
git push
Reset to known-good state (rewrites history)
git reset --soft HEAD~1
git reset HEAD~1
git reset --hard <commit-hash>
Checkout single file from a past commit
git checkout <commit-hash> -- path/to/file
Recover from a bad reset
git reflog
git reset --hard <reflog-entry>
Regression Hunting with git bisect
When a regression is found and the culprit commit is unknown:
git bisect start
git bisect bad
git bisect good <known-good>
git bisect bad
git bisect reset
Amend and Force-Push
Amend last commit (before push)
git add .
git commit --amend --no-edit
git commit --amend -m "new message"
Force-push (DESTRUCTIVE — only when necessary)
git push --force-with-lease origin <branch>
When safe to force-push:
- Your feature branch that only you use
- After
git rebase (rebase rewrites commit history)
- After amending commits not yet pushed
When to NEVER force-push:
- Shared branches (main, master, develop)
- Branch with active PR
- Branch others may have based work on
Tag and Release
Create a version tag
git tag -a v1.2.3 -m "Release 1.2.3: Add skill templates"
git push origin v1.2.3
Tag after version bump
git add CHANGELOG.md package.json
git commit -m "chore: bump version to 1.2.3"
git tag -a 1.2.3 -m "Version 1.2.3"
git push && git push --tags
List and verify tags
git tag -l
git show <tag-name>
Version Bump Sequence
- Verify:
npx tsc --noEmit passes
- Verify:
npm test passes
- Update
CHANGELOG.md with changes for this version
- Update
package.json version field
- Commit:
chore: bump version to X.Y.Z
- Tag:
git tag -a X.Y.Z -m "Release X.Y.Z"
- Publish:
npm publish --access public
- Verify:
npm view pi-crew shows new version
Stash Patterns
Stash work-in-progress
git stash -u
git stash push -m "WIP: feature X"
Apply and manage stashes
git stash list
git stash pop
git stash apply
git stash apply stash@{2}
git stash drop
git stash clear
Enforcement — Git Master Gate
Before committing or publishing, verify:
If ANY answer is NO → Stop. Fix issues before committing.
Anti-patterns
- Committing generated files: Don't commit
dist/, build/, *.min.js unless intentional
- Large commits: If >500 lines changed, consider splitting
- Committing with unverified tests: Run tests before commit
- Force-pushing main/master: Never
- Committing secrets: Check for
API_KEY, TOKEN, PASSWORD, SECRET before staging
- Unclear messages: "fix stuff" is not a valid commit message
Source patterns
src/state/atomic-write.ts — atomic git-safe file writes
src/worktree/worktree-manager.ts — worktree git operations
src/utils/conflict-detect.ts — git conflict detection
package.json — version field, publish scripts
Verification
cd pi-crew
git status --short
git log --oneline -5
git diff --staged --stat
npx tsc --noEmit
npm test
npm pack --dry-run