Git Commit Hygiene
Trigger Boundary
- •Use when commit quality, traceability, or reviewability must be improved.
- •Do not use for architecture decision records; use
architecture-decision-records. - •Do not use for source code style conventions; use language
*-style-guideskills.
Goal
Produce commit history that is easy to review, bisect, and audit.
Shared Git Contract (Canonical)
- •Use
../git-branch-strategy/references/git-governance-contract.mdas the single schema and gate source. - •Track commit hygiene artifacts with
GIT-CMT-*IDs. - •Run machine validation:
python3 ../git-branch-strategy/scripts/validate_git_contract.py --manifest <path/to/manifest.json>.
Inputs
- •Changed files and logical change boundaries
- •Team commit message conventions
- •Compliance and traceability requirements
Outputs
- •
GIT-CMT-*commit slicing and hygiene report - •Commit message standard and examples
- •Pre-push and CI checklist for history quality
Workflow
- •Separate unrelated changes into distinct logical commits.
- •Write intent-first commit messages with scope and rationale.
- •Verify each commit builds and passes relevant tests.
- •Run secret scanning on staged history in pre-push and CI.
- •Publish commit checklist and contract validation evidence.
Quality Gates
- •Each commit has one primary intent and reversible scope.
- •Commit messages explain why, not only what changed.
- •Commits are testable and bisect-friendly.
- •Secret scan passes before push (
checks.secret_scan_passed=true).
Failure Handling
- •Stop when a commit mixes unrelated behavioral changes.
- •Stop when secret scan detects credentials or personal data leakage.
- •Escalate when traceability requirements are unmet by current history.