Create atomic commits for staged/unstaged changes using chunk-based staging.
Commit Format
Title: module: Verb in imperative style
- •Lowercase module name before colon
- •Capital letter after colon
- •Imperative verb: Add, Fix, Update, Remove, Refactor
Body: Bullet points only
- •Lowercase start for each bullet
- •NO prose paragraphs
- •NO Co-Authored-By
- •NO Claude signatures
- •NO emojis
Process
- •Run
git statusandgit diffto understand all changes - •Run
git log -5 --onelineto see recent commit style - •Identify logical groups of changes that belong together
- •For each logical group:
- •Stage specific chunks with
git add -p <file>for modified files - •For new files:
git add -N <file> && git add -p <file> - •Verify staged changes:
git diff --cached - •Run
nix flake check - •Create commit using HEREDOC:
bash
git commit -m "$(cat <<'EOF' module: Title here - bullet point describing what changed - another bullet if needed EOF )"
- •Stage specific chunks with
- •Run
git log --oneline -5to verify
Fixup Commits
For iterations after review feedback, use fixup commits:
bash
git commit --fixup=HEAD
Or target a specific commit:
bash
git commit --fixup=<commit-hash>
Fixups will be squashed later with /branch-cleanup.
Chunk Staging Reference
Interactive patch mode (git add -p) commands:
- •
y- stage this hunk - •
n- skip this hunk - •
s- split into smaller hunks - •
q- quit, do not stage remaining hunks
Rules
- •One logical change per commit
- •Separate unrelated changes into different commits
- •NEVER push to remote
- •NEVER use --amend unless explicitly requested
- •NEVER skip nix flake check