Conventional Commit
Create a commit for all staged changes using conventional commit format.
Requirements
- •
Short message: Use conventional commit format (
type: description)- •Must be ≤100 columns
- •Be as clear as possible in user-facing terms
- •Common types: feat, fix, chore, docs, style, refactor, test, perf
- •
Body: Explain why the changes were made
- •Each line wrapped at 100 columns
- •Focus on the goal and reasoning, not just what changed (the diff shows that)
- •Format flexibly: prose, bullet points, or a mix depending on context
- •Use for insightful explanations or complex concepts that need elaboration
Steps
- •Run
git statusto see staged files - •Run
git diff --cachedto examine actual changes - •Run
git log --oneline -5to check existing commit style (if any) - •Draft a conventional commit message following the requirements above
- •Show the proposed message to the user
- •Create the commit using HEREDOC format:
bash
git commit -m "$(cat <<'EOF' type: short description here - Bullet point explaining change - Another bullet point EOF )"
- •Verify with
git log -1 --stat