Analyzes changes and automatically generates meaningful commit messages.
Workflow
Step 1: Identify changes
# 스테이징된 변경 확인
git diff --cached --stat
# 스테이징된 상세 변경 내용
git diff --cached
# 전체 변경 확인 (스테이징 전)
git status --short
Step 2: Analyze changes
| Analysis item | What to check |
|---|---|
| File type | Source code, configuration, documentation, tests, etc. |
| Change type | Addition, modification, deletion, refactoring |
| Scope of impact | Single feature, multiple modules, entire system |
| Key keywords | Function name, class name, module name |
Step 3: Generate message
Conventional Commits format:
<type>(<scope>): <subject>
<body>
Type selection criteria:
| Type | When to use |
|---|---|
feat |
Adding a new feature |
fix |
Bug fix |
docs |
Documentation change |
style |
Formatting, semicolons, etc. (no code change) |
refactor |
Refactoring (no functional change) |
test |
Adding/modifying tests |
chore |
Build, configuration file changes |
Step 4: Execute commit
# 메시지와 함께 커밋
git commit -m "type(scope): subject" -m "body"
# 또는 에디터로 상세 메시지 작성
git commit
Message writing rules
Subject
- Within 50 characters
- Imperative present tense ("Add", "Fix", "Update")
- No period
- Summarize the key changes
Body
- Wrap lines every 72 characters
- Whatwas changed
- 왜 was changed
- Include key keywords/function names
Example
Adding a single feature
feat(auth): add JWT token refresh endpoint
- Add /api/auth/refresh endpoint
- Implement token rotation logic
- Add 7-day refresh token expiry
Bug fix
fix(payment): resolve duplicate charge issue
- Add idempotency key validation
- Prevent concurrent payment requests
- Fix race condition in transaction handler
Multiple file changes
refactor(api): reorganize route handlers
Affected modules:
- userController: extract validation logic
- authMiddleware: simplify token check
- errorHandler: add custom error types
Breaking changes: None
Precautions
- Unstaged files are not committed
- It is recommended to split large changes into logical unit commits
- Check whether sensitive information (API keys, etc.) is included