Create a git commit for the currently staged changes.
Steps
- •
Run
git statusto see staged and unstaged changes - •
Run
git diff --cachedto review what will be committed - •
Analyze the changes and determine:
- •Type of change (feat, fix, refactor, docs, test, chore)
- •Brief summary of what changed
- •Why it changed (if not obvious)
- •
Create a commit message following this format:
- •First line: type and concise summary (max 72 chars)
- •Blank line
- •Body: explain what and why (wrap at 72 chars)
- •
Run
git commit -m "..."with the message - •
Show
git log -1to confirm
Commit Types
- •
feat: New feature - •
fix: Bug fix - •
refactor: Code restructuring without behavior change - •
docs: Documentation only - •
test: Adding or updating tests - •
chore: Maintenance tasks, dependencies, config
Examples
Good:
code
feat: add user authentication via OAuth Implements OAuth2 flow with Google and GitHub providers. Tokens are stored securely in httpOnly cookies.
Bad:
code
updated stuff