Commit Guidelines
Commit Guidelines
Section titled “Commit Guidelines”These rules are meant to keep the history clean, readable, and safe to ship. If you follow this doc, your commits will be easy to review and easy to revert.
Core Principles
Section titled “Core Principles”-
One commit = one logical change
- A commit should answer one question: “What changed and why?”
- Don’t mix unrelated work (e.g., UI polish + bug fix + refactor).
-
Small, reviewable diffs
- If a commit is too big to explain in one sentence, split it.
- Large refactors should be broken into safe, mechanical steps.
-
Clear intent in the message
- The commit message is the headline for your change.
- It should let someone understand the purpose without opening files.
-
Leave things better than you found them
- Fix small lint issues you touched, but do NOT reformat unrelated files.
Commit Message Format
Section titled “Commit Message Format”Use this format for most commits:
<scope>: <short, imperative summary>Examples:
email: fix thread refresh after replycalendar: add event detail modalauth: guard SSO routes on expired sessionui: align sidebar padding in compact mode
Rules:
- Use imperative mood (“add”, “fix”, “remove”, “update”).
- Keep it under ~72 characters if possible.
- Use a clear scope:
email,calendar,backend,auth,ui, etc.
When to Split Commits
Section titled “When to Split Commits”Split if you have:
- A refactor + a feature in the same change
- A bug fix + unrelated CSS changes
- Multiple files that don’t contribute to one clear goal
Example split:
calendar: extract event payload helpercalendar: add create event flow
When to Squash
Section titled “When to Squash”Squash if:
- You have multiple WIP commits (“try”, “fix again”, “oops”)
- You made small follow-up fixes that are part of the same change
Use interactive rebase to squash:
git rebase -i HEAD~NWhat Not to Commit
Section titled “What Not to Commit”- Secrets, API keys, credentials
- Debug logs or console spam
- Commented-out code
- Temporary files or local config files
Before You Commit (Quick Checklist)
Section titled “Before You Commit (Quick Checklist)”- Does the change compile or run locally?
- Did I run the relevant tests (or explain why not)?
- Did I avoid unrelated formatting changes?
- Is the commit message clear and scoped?
Recommended Workflow
Section titled “Recommended Workflow”- Review your changes:
git status -sb- Stage in chunks (recommended):
git add -p- Commit with a clear message:
git commit -m "scope: summary"- Verify your commit:
git log -n 1GPG Signing (If Required)
Section titled “GPG Signing (If Required)”If signing is enabled, use:
git commit -S -m "scope: summary"If your commit wasn’t signed, you can amend it:
git commit --amend -S --no-editExamples (Good vs Bad)
Section titled “Examples (Good vs Bad)”Bad:
fix stuffupdateswip
Good:
email: prevent duplicate replies in threadcalendar: show upcoming events in sidebarui: tighten spacing in inbox list
Final Notes
Section titled “Final Notes”If you’re unsure about splitting or naming:
- Ask a reviewer before you commit
- Prefer smaller commits with clear scopes
- Keep the history readable for someone new joining the project