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.4---56# ABOUTME: Git conventional commit format and version control best practices7# ABOUTME: Commit message standards, branch strategies, workflow patterns89# Source Control1011## Quick Reference1213```bash14git commit -m "feat: add user authentication"15git checkout -b feat/user-auth16git fetch origin && git rebase origin/main17git stash && git stash pop18```1920---2122## Conventional Commits2324**Format:** `<type>(<scope>): <subject>` (scope/body/footer optional)2526| Type | Use |27|------|-----|28| `feat` | New feature |29| `fix` | Bug fix |30| `docs` | Documentation |31| `style` | Formatting |32| `refactor` | Code restructure |33| `perf` | Performance |34| `test` | Tests |35| `chore` | Maintenance |36| `ci` | CI/CD |37| `build` | Build system |38| `revert` | Revert commit |3940**Rules:** Imperative mood, present tense, lowercase, no period, max 50 chars4142```bash43# Good44git commit -m "feat(auth): add JWT validation"45git commit -m "fix: resolve race condition"4647# Bad48git commit -m "Fixed stuff" # Not conventional49git commit -m "Feat: Add thing" # Capital letter50```5152---5354## Commit Process55561. **Check state:**57 ```bash58 git status && git diff HEAD && git branch --show-current && git log --oneline -559 ```60612. **Verify NOT on main/master** (abort if so, unless authorized)62633. **Stage specific files** (never `git add -A`):64 ```bash65 git add <specific-files>66 ```67684. **Commit with conventional format:**69 ```bash70 git commit -m "<type>(<scope>): <subject>"71 ```7273---7475## Branch Naming7677| Type | Pattern |78|------|---------|79| Feature | `feat/user-auth`, `feature/dashboard` |80| Fix | `fix/login-bug`, `bugfix/api-error` |81| Hotfix | `hotfix/security-patch` |82| Chore | `chore/update-deps` |8384---8586## Workflow8788```bash89# Start feature90git checkout main && git pull origin main91git checkout -b feat/user-auth9293# Keep up to date94git fetch origin && git rebase origin/main9596# After PR merged97git checkout main && git pull98git branch -d feat/user-auth99```100101| Use | When |102|-----|------|103| **Rebase** | Keep feature branch current, clean linear history |104| **Merge** | Integrate to main (via PR), preserve history |105106---107108## Post-PR Loop (babysitting)109110After a PR is opened, CI failures and review comments arrive asynchronously. Instead of Max polling, offer a time-based loop:111112```113/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 unaddressed114```115116Rules for the loop:117118- **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.119- Never force-push inside a loop; `--force-with-lease` only, and only for rebase-on-main conflicts Max asked for.120- 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.121- Match the interval to the external system: CI that takes ~10 minutes doesn't need a 2-minute loop.122- 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).123124---125126## Rules127128- NEVER push automatically (Max pushes manually; sole exception: an active Post-PR Loop, scoped to its PR branch, see above)129- NEVER work on `main`/`master` unless explicitly authorized130- Small, logical commits; no huge unrelated changes131- `--force-with-lease`, never bare `--force` on shared branches132- Run `make check && make test-e2e` before committing (see language skills for the expansion)133- Conflict resolution and recovery commands (reset, reflog, revert, amend): use standard git, no project-specific conventions here.