commit

trysmr's avatarfrom trysmr

Git変更をコミットしてリモートにプッシュ。「コミット」「コミットして」「pushして」「変更を保存して」と言われた時、またはバグ修正・新機能・リファクタリング完了後に使用

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 20, 2025

When & Why to Use This Skill

This Claude skill automates the Git version control workflow, allowing developers to commit and push changes to remote repositories using natural language commands. It enhances productivity by handling branch strategy verification, generating structured commit messages, and ensuring security best practices are followed before code is pushed.

Use Cases

  • Automating the commit and push process after completing bug fixes, new features, or code refactoring to maintain a steady development pace.
  • Ensuring consistent branch naming and commit message standards across a project by following predefined templates and prefixes like feature/, bugfix/, and refactor/.
  • Preventing security vulnerabilities by automatically checking for sensitive files such as .env or credentials before staging changes.
  • Streamlining repository management for developers who prefer a conversational interface to handle complex Git sequences like branch creation, staging, and upstream pushing.
namecommit
descriptionGit変更をコミットしてリモートにプッシュ。「コミット」「コミットして」「pushして」「変更を保存して」と言われた時、またはバグ修正・新機能・リファクタリング完了後に使用

Commit Workflow

このスキルは現在の変更をGitブランチにコミットしてリモートにプッシュします。

実行手順

1. ブランチ戦略の確認

まずREADME.mdを読み込んで、プロジェクトのブランチ戦略を理解してください:

Read README.md

ブランチ構成の例:

  • main: 本番環境(必須)
  • staging: ステージング環境(プロジェクトによっては存在しない場合がある)
  • feature/*: 新機能開発
  • bugfix/*: バグ修正
  • hotfix/*: 緊急修正
  • refactor/*: リファクタリング
  • chore/*: 設定変更・ビルド関連
  • test/*: テストコード
  • docs/*: ドキュメント作成・更新

ベースブランチの確認:

git branch -a

で利用可能なブランチを確認します。

2. 変更内容の確認

git status
git diff

で変更ファイルと差分を確認します。

3. ブランチ名の決定

変更内容に基づいて適切なブランチ名を決定:

  • プレフィックス: feature/、bugfix/、refactor/、chore/、test/、hotfix/、docs/
  • kebab-case形式
  • 例: bugfix/fix-login-error、feature/add-user-search、docs/update-api-spec

4. ブランチ作成(新しいブランチの場合)

すでに適切なブランチにいる場合はスキップしてください。

git checkout -b <branch-name>

5. コミット情報の準備

変更内容に基づいて、以下を準備します:

# ステージング
git add <files>

# ステージング内容の確認
git diff --cached

コミットメッセージ案を作成:

  • タイトル: 1行で簡潔に変更内容を記述
  • 詳細: 変更内容の具体的な説明(箇条書き)
  • 英語と日本語の間に余計な半角スペースを追加しない

6. ユーザー確認

以下の git commit コマンド形式でユーザーに提示し、コミットの許可を得てください:

git commit -m "$(cat <<'EOF'
タイトル(1行、簡潔に変更内容を記述)

- 変更内容の詳細1
- 変更内容の詳細2
- 変更内容の詳細3
EOF
)"

変更ファイル:

  • ファイル1
  • ファイル2
  • ...

重要: ユーザーの許可なしにコミットを実行しないでください。

7. コミット実行

ユーザーの許可を得てから、コミットを実行します:

git commit -m "$(cat <<'EOF'
タイトル(1行、簡潔に変更内容を記述)

- 変更内容の詳細1
- 変更内容の詳細2
- 変更内容の詳細3
EOF
)"

コミットメッセージは日本語で記述します。

8. リモートへプッシュ

# 新しいブランチの場合
git push -u origin <branch-name>

# 既存ブランチの場合
git push

チェックリスト

実行前に確認すべき項目:

  • README.mdを読み込んでブランチ戦略を理解した
  • git branch -aで利用可能なブランチを確認した
  • git statusとgit diffで変更内容を確認した
  • 適切なブランチプレフィックスを選択した
  • セキュリティ情報(.env, credentials等)を含まない
  • ステージング済みファイルとコミットメッセージ案をユーザーに提示した
  • ユーザーの許可を得てからコミットを実行した
  • コミットメッセージが明確で日本語で記述されている

使用例

例1: 既存ブランチでの追加コミット

ステップ1: 変更を確認

git branch
git status
git diff

ステップ2: ステージングと確認

git add docs/contact_relation_spec.md
git diff --cached
git diff --cached --name-only

ステップ3: ユーザーに提示

git commit -m "$(cat <<'EOF'
[タイトル: 1行で簡潔に変更内容を記述]

- [変更内容の詳細1]
- [変更内容の詳細2]
EOF
)"

変更ファイル:

  • [ファイルパス]

ステップ4: ユーザーの許可を待つ

ステップ5: 許可後にコミット・プッシュ

git commit -m "$(cat <<'EOF'
ユーザー検索機能を追加

- 名前・メールアドレスでの検索に対応
- ページネーション実装
EOF
)"

git push

例2: 新規ブランチでのコミット

ステップ1: ブランチ作成と変更確認

git checkout -b feature/add-user-search
git status
git diff

ステップ2: ステージングと確認

git add [ファイルパス]
git diff --cached --name-only

ステップ3: ユーザーに提示

git commit -m "$(cat <<'EOF'
[タイトル: 1行で簡潔に変更内容を記述]

- [変更内容の詳細1]
- [変更内容の詳細2]
EOF
)"

変更ファイル:

  • [ファイルパス]

ステップ4: ユーザーの許可を待つ

ステップ5: 許可後にコミット・プッシュ

git commit -m "$(cat <<'EOF'
ユーザー検索機能を追加

- 名前・メールアドレスでの検索に対応
- ページネーション実装
EOF
)"

git push -u origin feature/add-user-search

よくある間違い

❌ 間違い: セキュリティ情報(.env、credentials等)を含めてコミット ✅ 正解: .gitignoreに記載されたファイルは絶対にコミットしない

❌ 間違い: ユーザーの許可なしにコミットを実行 ✅ 正解: 必ずコミットメッセージと変更ファイルをユーザーに提示してから実行

❌ 間違い: コミットメッセージが英語 ✅ 正解: 日本語で明確に記述

❌ 間違い: git add .で全ファイルを無差別にステージング ✅ 正解: 必要なファイルのみを明示的に指定

次のステップ

コミット・プッシュ後にプルリクエストを作成する場合は、prスキルを使用してください。