Git Workflow
Branch Naming
Use a type prefix followed by a short slug:
feature/add-user-auth
fix/null-pointer-on-logout
chore/upgrade-dependencies
docs/update-api-reference
Types: feature (new functionality), fix (bug fixes), chore (maintenance, no behavior change), docs (documentation only), refactor (restructure without behavior change).
Slugs are lowercase, hyphen-separated, 3–5 words max.
Commit Message Format
Follow Conventional Commits:
type(scope): short description
Optional longer body explaining WHY, not WHAT.
Wrap at 72 characters.
Closes #123
- type:
feat,fix,chore,docs,refactor,test,perf - scope: the module or area affected (optional but helpful)
- description: imperative mood, lowercase, no period — "add retry logic" not "Added retry logic."
Examples:
feat(auth): add JWT refresh token rotation
fix(api): handle null response from upstream service
chore: upgrade eslint to v9
docs(readme): add curl install method
Workflow Steps
Branch — Always work on a branch, never directly on
maingit checkout -b feature/my-thingSmall commits — Commit logical units of work, not entire features in one shot. If you can't summarize the change in one line, split it.
Before committing — Run tests and linting. Don't commit broken code.
npm test && npm run lintCommit — Stage intentionally (avoid
git add -Afor sensitive repos)git add src/specific-file.ts git commit -m "feat(module): add thing"Push and PR — Push to origin, open a PR with a clear title matching your commit style. Include: what changed, why, how to test it.
Merge strategy — Prefer squash-merge for feature branches to keep
mainhistory clean. Use merge commits only for long-lived branches where history matters.
Anti-Patterns to Avoid
git add .when sensitive files (env, credentials) could be stagedgit push --forceon shared branches — rebase locally insteadgit reset --hardwithout confirming what you're discarding- Committing commented-out code, debug logs, or TODO-only commits
- Merge commits from
maininto your feature branch (rebase instead)
Checkpoint Before Ending a Session
Always run /checkpoint before wrapping up:
/checkpoint "describe what was done"
This runs tests, commits staged changes, and updates memory.
Source: Mercurium-Group/context-mogging — distributed by TomeVault.