Git Commit with Conventional Commits
Overview
Create standardized, semantic git commits using the Conventional Commits specification. Analyze the actual diff to determine appropriate type, scope, and message.
Conventional Commit Format
Exclamation mark after type/scope
feat!: remove deprecated endpoint
BREAKING CHANGE footer
feat: allow config to extend other configs
BREAKING CHANGE: extends key behavior changed
Workflow
1. Analyze Diff
If files are staged, use staged diff
git diff --staged
If nothing staged, use working tree diff
git diff
Also check status
git status --porcelain 2. Stage Files (if needed) If nothing is staged or you want to group changes differently:
Stage specific files
git add path/to/file1 path/to/file2
Stage by pattern
git add .test. git add src/components/*
Interactive staging
- git
- add
- -p
- Never commit secrets
- (.env, credentials.json, private keys).
- 3. Generate Commit Message
- Analyze the diff to determine:
- Type
-
- What kind of change is this?
- Scope
-
- What area/module is affected?
- Description
- One-line summary of what changed (present tense, imperative mood, <72 chars) 4. Execute Commit
Single line
git
commit
-m
"
Multi-line with body/footer
git
commit
-m
"
$(
cat
<<
'EOF'