Gitのブランチは以下の2つを基本として維持します。
主な開発フローは次のとおりです。
develop からトピックブランチ(例: feature/xxx、fix/yyy)を作成する。develop へマージしてステージング環境で動作確認を行う。develop を main に反映し、本番へデプロイする。必要に応じてリリースタグを作成して公開します。
git tag releaseYYYYMMDD
git push origin releaseYYYYMMDD
ブランチ名は短くても意味が伝わることが重要です。初期段階で若干雑になっても差し支えありませんが、リリース後はチームで読みやすい命名ルールに従うことを推奨します。
feature/<機能名>fix/<修正内容>hotfix/<対応内容>refactor/<対象>docs/<内容>feature/<チケット番号> など(例: feature/backlog1234)feature/user-authentication
fix/login-validation-error
hotfix/payment-gateway-timeout
refactor/api-error-handling
docs/setup-guide
test
fix
new-feature
update
ブランチ運用の安全性を確保するため、main ブランチと develop ブランチには保護ルールを設定することを推奨します。これらのルールにより、意図しない変更や事故を防ぎ、安定した開発フローを維持できます。
develop ブランチは開発の中心となるブランチのため、以下の保護ルールを適用します:
{
"id": 8265848,
"name": "Develop branch protection",
"target": "branch",
"source_type": "Repository",
"source": "GLANZ-CREATIVE/develop-branch-protection",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [],
"include": ["refs/heads/develop"]
}
},
"rules": [
{
"type": "deletion"
},
{
"type": "non_fast_forward"
},
{
"type": "pull_request",
"parameters": {
"required_approving_review_count": 0,
"dismiss_stale_reviews_on_push": false,
"require_code_owner_review": false,
"require_last_push_approval": false,
"required_review_thread_resolution": false,
"automatic_copilot_code_review_enabled": false,
"allowed_merge_methods": ["merge", "squash", "rebase"]
}
}
],
"bypass_actors": []
}
main ブランチは本番環境と同期する重要なブランチのため、より厳格な保護ルールを適用します:
{
"id": 8264380,
"name": "Main Protection",
"target": "branch",
"source_type": "Repository",
"source": "GLANZ-CREATIVE/main-branch-protection",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [],
"include": ["refs/heads/main"]
}
},
"rules": [
{
"type": "deletion"
},
{
"type": "non_fast_forward"
},
{
"type": "pull_request",
"parameters": {
"required_approving_review_count": 0,
"dismiss_stale_reviews_on_push": false,
"require_code_owner_review": false,
"require_last_push_approval": false,
"required_review_thread_resolution": false,
"automatic_copilot_code_review_enabled": false,
"allowed_merge_methods": ["merge"]
}
}
],
"bypass_actors": []
}
プロジェクトの規模やチーム構成に応じて、以下の設定を検討してください:
required_approving_review_count を1以上に設定require_code_owner_review を true に設定bypass_actors で特定のユーザーやチームに例外を設定