mcpField
G
git-branch-naming

git-branch-naming

github.com/laurigates開発5973 回インストール1 日前に更新
リポジトリ

git-branch-naming について

開発者やチーム向けの Git ブランチ命名ガイドです。種別の接頭辞、課題番号、説明文、特殊なブランチ形式を定め、一貫した命名と自動化に役立ちます。

主な機能

  1. 01種別・課題番号・説明の形式
  2. 02ブランチ種別と例の提示
  3. 03名前を検証する正規表現
  4. 04課題との関連付けと説明文
  5. 05リリースやホットフィックスの形式

活用シーン

  1. 01機能や修正用ブランチの命名
  2. 02チームの命名規約の策定
  3. 03自動化に向けた名前の検証

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/laurigates/claude-plugins --skill git-branch-naming

インストール後、Claude Code で/git-branch-namingを入力して読み込まれたか確認します。

詳細

Git ブランチの命名規則

一貫したブランチ命名により、追跡しやすくなり、自動化が可能になり、リポジトリの履歴をたどりやすくなります。

このスキルを使用する場面

次の場合はこのスキルを使用します...次の場合は別のものを使用します...
新しい機能/修正ブランチを作成するときPR ワークフローを管理するとき → git-branch-pr-workflow
チームのブランチ規則を設定するとき変更をコミットするとき → git-commit-workflow
命名規則について話し合うときリベース/マージ戦略を検討するとき → git-branch-pr-workflow

ブランチ名の形式

{type}/{issue}-{short-description}
要素形式必須例
type小文字の接頭辞はいfeat、fix
issue# を付けない課題番号課題がある場合123
descriptionkebab-case、2~5 語はいuser-authentication
例
# With issue number (preferred when issue exists)
feat/123-oauth-login
fix/456-null-pointer-crash
chore/789-update-dependencies
docs/101-api-reference

# Without issue number (when no issue exists)
feat/oauth-integration
fix/memory-leak-cleanup
chore/update-eslint-config
refactor/auth-service-split

ブランチの種類

種類目的Conventional Commit
feat/新機能、機能追加feat:
fix/バグ修正fix:
chore/メンテナンス、依存関係、設定chore:
docs/ドキュメントのみdocs:
refactor/動作を変更しないコードの再構成refactor:
test/テストの追加/更新test:
ci/CI/CD パイプラインの変更ci:
hotfix/本番環境の緊急修正fix:(緊急対応)
release/リリースの準備chore: または release:

ブランチの作成

標準的なワークフロー
# With issue number
git switch -c feat/123-user-authentication

# Without issue number
git switch -c fix/login-timeout-handling

# From specific base
git switch -c feat/456-payment-api main
git switch -c hotfix/security-patch production
検証パターン

作成前に、形式が正しいことを確認します。

# Branch name regex pattern
^(feat|fix|chore|docs|refactor|test|ci|hotfix|release)/([0-9]+-)?[a-z0-9]+(-[a-z0-9]+)*$

有効:

  • feat/123-user-auth ✓
  • fix/memory-leak ✓
  • chore/update-deps ✓

無効:

  • feature/user-auth ✗(feature ではなく feat を使用します)
  • fix/UserAuth ✗(PascalCase ではなく kebab-case を使用します)
  • my-branch ✗(種類の接頭辞がありません)
  • feat/fix_bug ✗(アンダースコアではなくハイフンを使用します)

課題リンクのベストプラクティス

課題番号を含める場面
シナリオ課題を含めるか例
GitHub Issues で作業を追跡しているはいfeat/123-add-oauth
外部システム(Jira、Linear)で作業を追跡している任意feat/PROJ-456-oauth または feat/oauth
探索的な作業/スパイク作業いいえspike/auth-approaches
課題のない軽微な修正いいえfix/typo-readme
Dependabot/自動 PRいいえchore/bump-lodash
外部チケットシステム

Jira、Linear、その他のシステムでは、チケット ID を使用します。

feat/PROJ-123-user-dashboard
fix/LINEAR-456-api-timeout
chore/JIRA-789-update-sdk

説明のガイドライン

良い説明
パターン例良い理由
アクション + 対象add-oauth-login何を行うのかが明確です
コンポーネント + 変更auth-service-refactor影響を受ける領域を特定できます
バグ + コンテキストnull-pointer-user-save問題の内容を説明しています
避けるべき例
アンチパターン問題点改善例
fix/bug曖昧すぎますfix/123-login-validation
feat/new-feature意味がありませんfeat/user-dashboard
feat/john-working-on-stuff内容を説明していませんfeat/456-payment-flow
fix/issue-123冗長で、説明がありませんfix/123-timeout-error
feat/add-new-user-authentication-system-with-oauth長すぎますfeat/oauth-authentication
長さのガイドライン
  • 最小: 種類/課題番号の後に 2 語(feat/123-user-auth)
  • 最大: 5 語、合計約 50 文字
  • 最適: 3~4 語(feat/123-oauth-token-refresh)

特殊なブランチパターン

リリースブランチ
release/1.0.0
release/2.1.0-beta
release/v3.0.0-rc1
ホットフィックスブランチ
hotfix/security-vulnerability
hotfix/critical-data-loss
hotfix/production-crash-fix
長期ブランチ

数週間にわたる作業では、日付のサフィックスを検討してください。

feat/123-major-refactor-2026q1
epic/new-billing-system

チームの規則

ユーザー名を接頭辞に付けるブランチ(任意)

ブランチの所有者を明確にする必要がある大規模チーム向け:

# Pattern: {user}/{type}/{description}
alice/feat/123-oauth
bob/fix/456-memory-leak

# Or: {type}/{user}-{description}
feat/alice-oauth-integration
fix/bob-memory-leak
保護対象ブランチのパターン

次のブランチにブランチ保護を設定します。

main
master
develop
release/*
hotfix/*

自動化との連携

ブランチ名 → コミットのスコープ

ブランチの種類は、コミットメッセージのスコープを決める際の参考になります。

ブランチ推奨されるコミット
feat/123-authfeat(auth): ...
fix/456-apifix(api): ...
docs/readmedocs: ...
CI/CD のトリガー

CI パイプラインのトリガーによく使われるパターン:

# GitHub Actions example
on:
  push:
    branches:
      - 'feat/**'
      - 'fix/**'
      - 'hotfix/**'
  pull_request:
    branches:
      - main

クイックリファレンス

ブランチ作成チェックリスト
  • 有効な種類のプレフィックス(feat/、fix/ など)で始まっている
  • 課題番号が含まれている(追跡対象の作業の場合)
  • 説明がケバブケースになっている
  • 説明が 2~5 語になっている
  • 全体の長さが 50 文字未満である
  • アンダースコア、スペース、大文字が含まれていない
コマンドリファレンス
操作コマンド
ブランチを作成git switch -c feat/123-description
種類別に一覧表示git branch --list 'feat/*'
ローカルブランチを削除git branch -d feat/123-description
リモートブランチを削除git push origin --delete feat/123-description
名前を変更git branch -m old-name new-name
種類選択のフローチャート
Is it a bug fix? → fix/
Is it a new capability? → feat/
Is it documentation? → docs/
Is it maintenance/deps? → chore/
Is it restructuring code? → refactor/
Is it adding tests? → test/
Is it CI/CD changes? → ci/
Is it an emergency? → hotfix/

コメント