Create commits by appropriately splitting changes by feature and by content.
Commit Prefix
Use the following prefixes appropriately:
| prefix | Purpose | Example |
|---|---|---|
feat |
New feature addition / UI / behavior changes | feat: ログインダイアログ追加 |
chore |
Settings, dependencies, CI, etc. | chore: eslint設定更新 |
test |
Adding or fixing tests | test: ArticleCard テスト追加 |
docs |
Documentation changes | docs: README更新 |
refactor |
Internal improvements that do not change user-visible behavior | refactor: formatTimeAgo を共通関数に抽出 |
fix |
Bug fixes (fixing unintended behavior) | fix: ダイアログが閉じない問題 |
Commit Message Format
feat, chore, test, docs
One line only. Write the content concisely after the prefix.
feat: 記事一覧を2列グリッドに変更
refactor, fix
On the third line, write **why the change was necessary (the reason)**.
refactor: ArticleCard の formatTimeAgo をユーティリティに抽出
複数コンポーネントで同じ日時フォーマットロジックを使う必要が出たため。
fix: ログインダイアログが閉じない問題を修正
onOpenChange のコールバックが state を更新していなかったため。
Rules
- Split commits by feature and by content — do not mix unrelated changes into a single commit
- Do not include diffs other than what is written in the commit message —
git addexplicitly specify the target files (git add -Aやgit add .do not use) - Write in Japanese — everything except the prefix is in Japanese
- Add Co-Authored-By at the end
Procedure
git statusとgit diffto grasp all the changes- Group changes by feature and purpose
- For each group, do the following:
a. Stage only the target files with
git add <file1> <file2> ...b. Create the commit message (following the format above) c.git commitrun - After all commits are complete,
git log --oneline -n <count>to confirm
Example Workflow
# 1. 変更把握
git status
git diff --stat
# 2. 機能Aのファイルだけステージング
git add src/components/features/timeline-page/timeline/Timeline.tsx
git add src/components/features/timeline-page/timeline/article-card/ArticleCard.tsx
# 3. コミット
git commit -m "$(cat <<'EOF'
feat: タイムライン記事一覧を2列グリッドに変更
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EOF
)"
# 4. 機能Bのファイルだけステージング
git add src/app/layout.tsx
# 5. コミット
git commit -m "$(cat <<'EOF'
fix: layout.tsx の二重パディング修正
outer div の px-10 を削除し main を px-8 に変更。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EOF
)"