ABOUTME: Git conventional commit format and version control best practices
ABOUTME: Commit message standards, branch strategies, workflow patterns
Source Control
Quick Reference
git commit -m "feat: add user authentication"
git checkout -b feat/user-auth
git fetch origin && git rebase origin/main
git stash && git stash pop
Conventional Commits
Format: <type>(<scope>): <subject> (scope/body/footer optional)
| Type |
Use |
feat |
New feature |
fix |
Bug fix |
docs |
Documentation |
style |
Formatting |
refactor |
Code restructure |
perf |
Performance |
test |
Tests |
chore |
Maintenance |
ci |
CI/CD |
build |
Build system |
revert |
Revert commit |
Rules: Imperative mood, present tense, lowercase, no period, max 50 chars
# Good
git commit -m "feat(auth): add JWT validation"
git commit -m "fix: resolve race condition"
# Bad
git commit -m "Fixed stuff" # Not conventional
git commit -m "Feat: Add thing" # Capital letter
Commit Process
Check state:
git status && git diff HEAD && git branch --show-current && git log --oneline -5
Verify NOT on main/master (abort if so, unless authorized)
Stage specific files (never git add -A):
git add <specific-files>
Commit with conventional format:
git commit -m "<type>(<scope>): <subject>"
Branch Naming
| Type |
Pattern |
| Feature |
feat/user-auth, feature/dashboard |
| Fix |
fix/login-bug, bugfix/api-error |
| Hotfix |
hotfix/security-patch |
| Chore |
chore/update-deps |
Workflow
# Start feature
git checkout main && git pull origin main
git checkout -b feat/user-auth
# Keep up to date
git fetch origin && git rebase origin/main
# After PR merged
git checkout main && git pull
git branch -d feat/user-auth
| Use |
When |
| Rebase |
Keep feature branch current, clean linear history |
| Merge |
Integrate to main (via PR), preserve history |
Post-PR Loop (babysitting)
After a PR is opened, CI failures and review comments arrive asynchronously. Instead of Max polling, offer a time-based loop:
/loop 10m check PR #<N>: if CI failed, diagnose and fix; if new review comments, address them; commit fixes on the PR branch and push; stop when CI is green and no comments are unaddressed
Rules for the loop:
- Push authorization: Max starting the
/loop on a PR is the explicit push authorization, scoped to that PR branch and that loop session only. Outside a PR loop, the NEVER-push rule stands unchanged.
- Never force-push inside a loop;
--force-with-lease only, and only for rebase-on-main conflicts Max asked for.
- Commits inside the loop follow the same conventional format and pre-commit gate (
make check && make test-e2e); hooks are never bypassed under loop time pressure.
- Match the interval to the external system: CI that takes ~10 minutes doesn't need a 2-minute loop.
- Stop condition is part of the prompt (CI green + comments addressed); the loop must not idle-run after the PR merges: cancel it from the session that started it (interrupt, or ask the loop to stop).
Rules
- NEVER push automatically (Max pushes manually; sole exception: an active Post-PR Loop, scoped to its PR branch, see above)
- NEVER work on
main/master unless explicitly authorized
- Small, logical commits; no huge unrelated changes
--force-with-lease, never bare --force on shared branches
- Run
make check && make test-e2e before committing (see language skills for the expansion)
- Conflict resolution and recovery commands (reset, reflog, revert, amend): use standard git, no project-specific conventions here.
1---2name: source-control3description: "Git conventions for commit messages and workflow. Use for git commit, conventional commits, branch strategy, rebasing, merge conflicts, git workflow. Not for general code changes that happen to need a commit afterward."4allowed-tools: [Bash]5---67# ABOUTME: Git conventional commit format and version control best practices8# ABOUTME: Commit message standards, branch strategies, workflow patterns910# Source Control1112## Quick Reference1314```bash15git commit -m "feat: add user authentication"16git checkout -b feat/user-auth17git fetch origin && git rebase origin/main18git stash && git stash pop19```2021---2223## Conventional Commits2425**Format:** `<type>(<scope>): <subject>` (scope/body/footer optional)2627| Type | Use |28|------|-----|29| `feat` | New feature |30| `fix` | Bug fix |31| `docs` | Documentation |32| `style` | Formatting |33| `refactor` | Code restructure |34| `perf` | Performance |35| `test` | Tests |36| `chore` | Maintenance |37| `ci` | CI/CD |38| `build` | Build system |39| `revert` | Revert commit |4041**Rules:** Imperative mood, present tense, lowercase, no period, max 50 chars4243```bash44# Good45git commit -m "feat(auth): add JWT validation"46git commit -m "fix: resolve race condition"4748# Bad49git commit -m "Fixed stuff" # Not conventional50git commit -m "Feat: Add thing" # Capital letter51```5253---5455## Commit Process56571. **Check state:**58 ```bash59 git status && git diff HEAD && git branch --show-current && git log --oneline -560 ```61622. **Verify NOT on main/master** (abort if so, unless authorized)63643. **Stage specific files** (never `git add -A`):65 ```bash66 git add <specific-files>67 ```68694. **Commit with conventional format:**70 ```bash71 git commit -m "<type>(<scope>): <subject>"72 ```7374---7576## Branch Naming7778| Type | Pattern |79|------|---------|80| Feature | `feat/user-auth`, `feature/dashboard` |81| Fix | `fix/login-bug`, `bugfix/api-error` |82| Hotfix | `hotfix/security-patch` |83| Chore | `chore/update-deps` |8485---8687## Workflow8889```bash90# Start feature91git checkout main && git pull origin main92git checkout -b feat/user-auth9394# Keep up to date95git fetch origin && git rebase origin/main9697# After PR merged98git checkout main && git pull99git branch -d feat/user-auth100```101102| Use | When |103|-----|------|104| **Rebase** | Keep feature branch current, clean linear history |105| **Merge** | Integrate to main (via PR), preserve history |106107---108109## Post-PR Loop (babysitting)110111After a PR is opened, CI failures and review comments arrive asynchronously. Instead of Max polling, offer a time-based loop:112113```114/loop 10m check PR #<N>: if CI failed, diagnose and fix; if new review comments, address them; commit fixes on the PR branch and push; stop when CI is green and no comments are unaddressed115```116117Rules for the loop:118119- **Push authorization:** Max starting the `/loop` on a PR **is** the explicit push authorization, scoped to that PR branch and that loop session only. Outside a PR loop, the NEVER-push rule stands unchanged.120- Never force-push inside a loop; `--force-with-lease` only, and only for rebase-on-main conflicts Max asked for.121- Commits inside the loop follow the same conventional format and pre-commit gate (`make check && make test-e2e`); hooks are never bypassed under loop time pressure.122- Match the interval to the external system: CI that takes ~10 minutes doesn't need a 2-minute loop.123- Stop condition is part of the prompt (CI green + comments addressed); the loop must not idle-run after the PR merges: cancel it from the session that started it (interrupt, or ask the loop to stop).124125---126127## Rules128129- NEVER push automatically (Max pushes manually; sole exception: an active Post-PR Loop, scoped to its PR branch, see above)130- NEVER work on `main`/`master` unless explicitly authorized131- Small, logical commits; no huge unrelated changes132- `--force-with-lease`, never bare `--force` on shared branches133- Run `make check && make test-e2e` before committing (see language skills for the expansion)134- Conflict resolution and recovery commands (reset, reflog, revert, amend): use standard git, no project-specific conventions here.