AI Project Manager #11 担当領域
2025年最新版 - Git/GitHubを使った実務での作業フローを、具体的なコマンドとともに解説
- 個人開発フロー
- チーム開発フロー(Feature Branch)
- GitHub Flowフロー
- Git Flowフロー
- オープンソース貢献フロー
- Issue駆動開発フロー
- ホットフィックスフロー
- リリースフロー
シンプルな個人プロジェクトでの作業フロー。
# プロジェクトディレクトリ作成
mkdir my-project
cd my-project
# Git初期化
git init
# 初期ファイル作成
echo # My Project > README.md
# 最初のコミット
git add README.md
git commit -m "Initial commit"
# GitHub リポジトリと連携
git remote add origin https://github.com/username/my-project.git
git branch -M main
git push -u origin main# プロジェクトディレクトリ作成
mkdir my-project
cd my-project
# Git初期化
git init
# 初期ファイル作成
echo "# My Project" > README.md
# 最初のコミット
git add README.md
git commit -m "Initial commit"
# GitHub リポジトリと連携
git remote add origin https://github.com/username/my-project.git
git branch -M main
git push -u origin mainWindows/Mac共通:
# 1. 作業開始前に最新を取得
git pull
# 2. ファイルを編集
# (エディタでコード編集)
# 3. 変更を確認
git status
git diff
# 4. 変更をステージング
git add .
# または特定ファイルのみ
git add src/index.js
# 5. コミット
git commit -m "Add new feature"
# 6. GitHubにプッシュ
git push# ステージングを取り消し(ファイルは変更されたまま)
git reset HEAD <ファイル名>
# ファイルの変更を完全に取り消し
git checkout -- <ファイル名>
# すべての変更を取り消し(危険!)
git reset --hard HEAD# 直前のコミットをやり直し(まだプッシュしていない場合)
git commit --amend -m "Updated commit message"
# コミットを取り消す(変更は残る)
git reset --soft HEAD~1
# コミットを取り消す(変更も取り消す)
git reset --hard HEAD~1最も一般的なチーム開発ワークフロー。
main ─────────────●─────────●────────────→
\ /
\ /
feature/xxx ●─────●
mainブランチから機能ブランチを作成- 機能ブランチで開発
- Pull Request 作成
- コードレビュー
mainにマージ
Windows/Mac共通:
# mainブランチに移動
git checkout main
# 最新を取得
git pull origin main# 新しいブランチを作成して切り替え
git checkout -b feature/add-login
# または Git 2.23 以降
git switch -c feature/add-loginブランチ命名規則の例:
feature/機能名- 新機能bugfix/バグ名- バグ修正hotfix/緊急修正名- 緊急修正refactor/リファクタ内容- リファクタリングdocs/ドキュメント名- ドキュメント更新
# ファイル編集
# ...
# 変更を確認
git status
git diff
# ステージング
git add .
# コミット(わかりやすいメッセージで)
git commit -m "feat: Add login form component"
# さらに開発を続ける
# ...
git add .
git commit -m "feat: Add authentication logic"
git commit -m "test: Add login tests"コミットメッセージの例(Conventional Commits):
feat:- 新機能fix:- バグ修正docs:- ドキュメントstyle:- フォーマットrefactor:- リファクタリングtest:- テストchore:- その他
# 初回プッシュ(アップストリーム設定)
git push -u origin feature/add-login
# 2回目以降
git pushGitHub上で:
- リポジトリページにアクセス
- 「Compare & pull request」ボタンをクリック
- PR情報を入力:
## 変更内容 ログイン機能を追加しました。 ## 関連Issue Closes #123 ## スクリーンショット (あれば画像添付) ## テスト - [ ] ユニットテストが通る - [ ] ログイン成功 - [ ] ログイン失敗時のエラー表示
- Reviewers を指定
- 「Create pull request」をクリック
レビューコメントへの対応:
# ファイルを修正
# ...
# コミット
git add .
git commit -m "fix: Address review comments"
# プッシュ(PRに自動反映)
git pushGitHub上で:
- レビュー承認を確認
- 「Merge pull request」をクリック
- マージ方法を選択:
- Merge commit - すべてのコミットを保持
- Squash and merge - 1つのコミットにまとめる(推奨)
- Rebase and merge - リベースしてマージ
- 「Confirm merge」
- 「Delete branch」でブランチ削除
# mainに戻る
git checkout main
# 最新を取得
git pull origin main
# マージ済みブランチを削除
git branch -d feature/add-login
# リモート追跡ブランチも削除
git fetch --prune開発中に main が更新された場合。
# 機能ブランチで作業中
git checkout feature/add-login
# mainの最新を取得
git fetch origin
# mainをマージ
git merge origin/main
# コンフリクトがあれば解決
# ...
# プッシュ
git push# mainの最新を取得
git fetch origin
# リベース
git rebase origin/main
# コンフリクトがあれば解決して続行
git add .
git rebase --continue
# プッシュ(履歴が変わるので強制プッシュ必要)
git push --force-with-leaseシンプルで継続的デプロイに適したフロー。
mainブランチは常にデプロイ可能- 新しい作業は
mainから分岐 - ブランチ名はわかりやすく
- 定期的にプッシュ
- Pull Request でディスカッション
- マージ後すぐデプロイ
# 1. mainから分岐
git checkout main
git pull origin main
git checkout -b improve-search
# 2. 開発・コミット
git add .
git commit -m "Improve search algorithm"
git push -u origin improve-search
# 3. PR作成(GitHub上で)
# 4. レビュー・マージ
# 5. デプロイ(自動またはマージ後).github/workflows/deploy.yml:
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deploy to production
run: ./deploy.sh大規模プロジェクトやリリースサイクルがあるプロジェクト向け。
main (production)
│
├── develop (development)
│ │
│ ├── feature/xxx
│ ├── feature/yyy
│ └── feature/zzz
│
└── release/v1.0.0
│
└── hotfix/critical-bug
ブランチ種類:
- main - 本番環境(常に安定)
- develop - 開発ブランチ
- feature/ - 機能ブランチ
- release/ - リリース準備ブランチ
- hotfix/ - 緊急修正ブランチ
# 1. developから機能ブランチ作成
git checkout develop
git pull origin develop
git checkout -b feature/new-dashboard
# 2. 開発
git add .
git commit -m "Add dashboard component"
git push -u origin feature/new-dashboard
# 3. PR作成(develop へマージ)
# 4. マージ後、ブランチ削除
git checkout develop
git pull origin develop
git branch -d feature/new-dashboard# 1. developからreleaseブランチ作成
git checkout develop
git pull origin develop
git checkout -b release/v1.2.0
# 2. バージョン番号更新
# package.json, README.md などを更新
git add .
git commit -m "Bump version to 1.2.0"
git push -u origin release/v1.2.0
# 3. テスト・バグ修正
# バグがあれば修正してコミット
# 4. mainへマージ(PR経由)
# GitHub上でPR作成: release/v1.2.0 → main
# 5. タグ付け
git checkout main
git pull origin main
git tag -a v1.2.0 -m "Release version 1.2.0"
git push origin v1.2.0
# 6. developへもマージ(バックマージ)
git checkout develop
git merge main
git push origin develop
# 7. releaseブランチ削除
git branch -d release/v1.2.0
git push origin --delete release/v1.2.0# 1. mainからhotfixブランチ作成
git checkout main
git pull origin main
git checkout -b hotfix/critical-security-fix
# 2. 緊急修正
git add .
git commit -m "Fix critical security vulnerability"
git push -u origin hotfix/critical-security-fix
# 3. mainへマージ(PR経由)
# GitHub上でPR作成: hotfix/critical-security-fix → main
# 4. タグ付け
git checkout main
git pull origin main
git tag -a v1.2.1 -m "Hotfix: Critical security fix"
git push origin v1.2.1
# 5. developへもマージ
git checkout develop
git merge main
git push origin develop
# 6. hotfixブランチ削除
git branch -d hotfix/critical-security-fix
git push origin --delete hotfix/critical-security-fix他人のリポジトリに貢献する際のフロー。
- リポジトリをフォーク
- クローン
- ブランチ作成
- 変更・コミット
- フォークにプッシュ
- Pull Request 作成
- レビュー対応
- マージ
GitHub上で:
- 貢献したいリポジトリにアクセス
- 右上の「Fork」ボタンをクリック
- 自分のアカウントにフォークが作成される
Windows:
# フォークをクローン
git clone https://github.com/YOUR_USERNAME/repository.git
cd repository
# オリジナルをupstreamとして追加
git remote add upstream https://github.com/ORIGINAL_OWNER/repository.git
# 確認
git remote -vMac:
# フォークをクローン
git clone https://github.com/YOUR_USERNAME/repository.git
cd repository
# オリジナルをupstreamとして追加
git remote add upstream https://github.com/ORIGINAL_OWNER/repository.git
# 確認
git remote -v# 最新のupstream/mainを取得
git fetch upstream
git checkout main
git merge upstream/main
# 機能ブランチ作成
git checkout -b fix-typo-in-readme# ファイル編集
# ...
# コミット
git add .
git commit -m "docs: Fix typo in README"# 自分のフォークにプッシュ
git push -u origin fix-typo-in-readmeGitHub上で:
- 自分のフォークページにアクセス
- 「Compare & pull request」をクリック
- PR情報を入力:
## 変更内容 READMEのタイポを修正しました。 ## 変更箇所 - 行123: "recieve" → "receive"
- 「Create pull request」をクリック
# レビューコメントに対応
# ファイル修正
git add .
git commit -m "Address review feedback"
git push開発中にオリジナルが更新された場合:
# upstreamから最新を取得
git fetch upstream
# 自分のブランチにマージ
git merge upstream/main
# コンフリクト解決(あれば)
# ...
# プッシュ
git push定期的にオリジナルと同期:
# mainブランチで
git checkout main
# upstreamから取得
git fetch upstream
# マージ
git merge upstream/main
# フォークを更新
git push origin mainまたは GitHub上で:
- フォークページにアクセス
- 「Sync fork」ボタンをクリック
- 「Update branch」
Issue を起点とした開発フロー。
Issue作成 → ブランチ作成 → 開発 → PR作成 → レビュー → マージ → Issue自動クローズ
GitHub上で:
- Issues → New issue
- 内容記入:
## バグ内容 ログインフォームでメールアドレスバリデーションが機能していない ## 再現手順 1. ログインページにアクセス 2. 無効なメールアドレスを入力 3. 送信ボタンをクリック ## 期待される動作 エラーメッセージが表示される ## 実際の動作 エラーが表示されずに送信される
- Label:
bug - Assignee: 自分
- 「Submit new issue」→ #123 が作成される
GitHub上で(推奨):
- Issue詳細画面の右サイドバー
- Development → Create a branch
- ブランチ名:
123-fix-email-validation - 「Create branch」
またはローカルで:
git checkout main
git pull origin main
git checkout -b 123-fix-email-validation# ファイル修正
# ...
git add .
git commit -m "fix: Add email validation to login form
Fixes #123"コミットメッセージでIssue参照:
Fixes #123- マージ時に自動クローズCloses #123- 同上Resolves #123- 同上Relates to #123- 参照のみ(クローズしない)
git push -u origin 123-fix-email-validationGitHub上で:
- PR作成
- 説明欄に
Fixes #123を記載 - 「Create pull request」
PRがマージされると、Issue #123 が自動的にクローズされる。
# コミットメッセージで複数Issue参照
git commit -m "feat: Add search and filter
Fixes #45
Fixes #67
Relates to #89"本番環境の緊急バグ修正。
# 1. mainから直接hotfixブランチ作成
git checkout main
git pull origin main
git checkout -b hotfix/critical-bug
# 2. 修正
git add .
git commit -m "hotfix: Fix critical payment processing bug"
# 3. プッシュ
git push -u origin hotfix/critical-bug
# 4. PR作成(mainへ)
# レビューを簡略化して迅速にマージ
# 5. マージ後、即座にデプロイ
# 6. developへもバックマージ
git checkout develop
git pull origin develop
git merge main
git push origin develop# 1. mainからhotfixブランチ
git checkout main
git pull origin main
git checkout -b hotfix/security-patch
# 2. 修正
git add .
git commit -m "hotfix: Patch security vulnerability"
# 3. テスト環境でテスト
git push -u origin hotfix/security-patch
# 4. PR作成・レビュー
# 5. マージ・デプロイ# mainでタグ付け
git checkout main
git pull origin main
git tag -a v1.2.1 -m "Hotfix: Critical bug fix"
git push origin v1.2.1
# GitHub Releasesで公開バージョン管理とリリース手順。
MAJOR.MINOR.PATCH (例: 2.4.1)
- MAJOR - 互換性のない変更
- MINOR - 後方互換性のある機能追加
- PATCH - 後方互換性のあるバグ修正
# developからリリースブランチ
git checkout develop
git pull origin develop
git checkout -b release/v2.0.0package.json:
{
"name": "my-app",
"version": "2.0.0",
...
}CHANGELOG.md:
## [2.0.0] - 2025-10-13
### Added
- 新しいダッシュボードUI
- ダークモード対応
### Changed
- API エンドポイントを v2 に変更
### Deprecated
- 旧 API v1 は非推奨(v3で削除予定)
### Removed
- レガシー認証システムを削除
### Fixed
- ログインフォームのバグ修正
### Security
- セキュリティ脆弱性を修正git add .
git commit -m "chore: Bump version to 2.0.0"
git push -u origin release/v2.0.0# テスト環境でのテスト
npm test
npm run e2eバグがあれば修正:
git add .
git commit -m "fix: Fix test failures"
git pushGitHub上でPR:
release/v2.0.0→main- レビュー・承認
- マージ
git checkout main
git pull origin main
# アノテーション付きタグ
git tag -a v2.0.0 -m "Release version 2.0.0
- New dashboard UI
- Dark mode support
- API v2 migration"
git push origin v2.0.0GitHub上で:
- Releases → Draft a new release
- Choose a tag →
v2.0.0 - Release title →
v2.0.0 - Dashboard Redesign - Description → CHANGELOG からコピー
- Attach binaries - ビルド成果物(あれば)
- Publish release
git checkout develop
git pull origin develop
git merge main
git push origin developgit branch -d release/v2.0.0
git push origin --delete release/v2.0.0.github/workflows/release.yml:
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/app.zip
asset_name: app.zip
asset_content_type: application/zip| プロジェクト種類 | 推奨フロー | 理由 |
|---|---|---|
| 個人プロジェクト | 個人開発フロー | シンプルで十分 |
| 小規模チーム(2-5人) | GitHub Flow | シンプルで継続的デプロイに適する |
| 中規模チーム(5-15人) | Feature Branch | バランスが良い |
| 大規模プロジェクト | Git Flow | 厳格なリリース管理 |
| オープンソース | OSS貢献フロー | フォークベース |
| 緊急対応 | Hotfix フロー | 迅速な修正 |
良い例:
feat: Add user authentication
- Implement JWT-based authentication
- Add login/logout endpoints
- Add password hashing with bcrypt
Closes #123
悪い例:
update files
良い例:
feature/user-authenticationbugfix/login-validationhotfix/security-patch123-fix-email-validation(Issue番号付き)
悪い例:
testfixmy-branch
良い例:
- 明確なタイトル
- 変更内容の説明
- スクリーンショット(UI変更の場合)
- テスト結果
- 関連Issue参照
悪い例:
- タイトルだけ
- 説明なし
- 巨大なPR(1000行以上の変更)
レビュアーの心得:
- 建設的なフィードバック
- 具体的な改善提案
- 良い点も指摘する
- タイムリーにレビュー
PR作成者の心得:
- 小さく分割したPR
- 自己レビュー済み
- テスト済み
- ドキュメント更新
スプリントベースの反復開発フロー。
# スプリントブランチ作成
git checkout main
git pull origin main
git checkout -b sprint/2025-Q1-S3
# スプリント計画をCommit
echo "Sprint 2025-Q1-S3 Planning" > SPRINT_PLANNING.md
git add SPRINT_PLANNING.md
git commit -m "docs: Add sprint 2025-Q1-S3 planning"
git push -u origin sprint/2025-Q1-S3# ユーザーストーリーブランチ作成
git checkout sprint/2025-Q1-S3
git checkout -b feature/user-story-123
# 開発・テスト・コミット
git add .
git commit -m "feat: implement user story #123 - user profile management
- Add user profile component
- Implement profile update API
- Add unit tests for profile service
- Add integration tests
Resolves #123"
# スプリントブランチにマージ
git checkout sprint/2025-Q1-S3
git merge feature/user-story-123
git push origin sprint/2025-Q1-S3# mainへのマージ(スプリント終了時)
git checkout main
git merge sprint/2025-Q1-S3
git tag -a v2025.1.3 -m "Sprint 2025-Q1-S3 Release"
git push origin main --tagsCI/CD、インフラ管理、モニタリングを統合した開発フロー。
# インフラ変更用ブランチ
git checkout -b infra/add-monitoring
# Terraformファイル更新
# terraform/, docker-compose.yml, k8s/ 等を編集
git add terraform/
git commit -m "infra: add monitoring stack with Prometheus and Grafana
- Add Prometheus configuration
- Add Grafana dashboards
- Update Kubernetes manifests
- Add health check endpoints
Infrastructure Changes:
- New monitoring namespace
- Persistent volumes for metrics
- Service discovery configuration"
# Pull Request作成(自動CI/CDトリガー)
git push -u origin infra/add-monitoring# .github/workflows/deploy.yml の例
name: Deploy to Production
on:
push:
branches: [main]
tags: ['v*']
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Blue-Green Deployment
run: |
# Blue-Green deployment logic
kubectl apply -f k8s/blue/
kubectl wait --for=condition=ready pod -l app=myapp-blue
kubectl patch service myapp -p '{"spec":{"selector":{"version":"blue"}}}'# アラート設定の更新
git checkout -b monitoring/update-alerts
# Prometheus alerting rules 更新
# Grafana dashboard 更新
# アラート通知設定 更新
git add monitoring/
git commit -m "monitoring: update critical alerts for production
- Add memory usage alerts
- Update response time thresholds
- Configure Slack notifications
- Add runbook links to alerts"
git push -u origin monitoring/update-alerts分散チーム開発に最適化されたワークフロー。
# 作業開始時の同期
git checkout main
git pull origin main
# 作業状況を明確に記録
git checkout -b feature/async-work-item
echo "## Work Progress for $(date)" >> WORK_LOG.md
echo "- Starting work on user authentication" >> WORK_LOG.md
git add WORK_LOG.md
git commit -m "docs: start work on user authentication feature"
git push -u origin feature/async-work-item# 作業途中でもDraft PRを作成
# GitHub CLIを使用
gh pr create --draft \
--title "WIP: User authentication feature" \
--body "## Progress
- ✅ Set up authentication middleware
- ⏳ Working on JWT validation
- ⏸️ TODO: Add tests and documentation
## Questions for Review
- Should we use RS256 or HS256 for JWT?
- Any preferences for session management?
## Timeline
Expected completion: End of this week"# ペアプログラミングセッション記録
git commit -m "feat: implement JWT authentication
Co-authored-by: Partner Name <partner@email.com>
Pair programming session:
- Implemented JWT token generation
- Added middleware for token validation
- Discussed error handling strategies
- Reviewed security best practices"GitHub Copilot、ChatGPT、その他AIツールを活用した効率的開発フロー。
# AIで生成したコードのレビュープロセス
git checkout -b feature/ai-assisted-feature
# 1. AI promptとレスポンスを記録
echo "AI Prompt: Generate a React component for user profile" > AI_GENERATION_LOG.md
echo "Tool: GitHub Copilot" >> AI_GENERATION_LOG.md
echo "Generated: UserProfile.tsx" >> AI_GENERATION_LOG.md
# 2. 生成されたコードをレビュー・修正
# 3. テスト追加
# 4. ドキュメント更新
git add .
git commit -m "feat: add user profile component
Generated with GitHub Copilot assistance:
- Base component structure
- Props interface definition
- Basic styling
Manual additions:
- Comprehensive error handling
- Accessibility features
- Unit tests
- Integration tests
AI-Review-Required: true"# .github/workflows/ai-review.yml
name: AI Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
ai-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: AI Security Review
uses: github/super-linter@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: AI Performance Analysis
run: |
# AI-powered performance analysis
echo "Running AI performance analysis..."# AIでドキュメント生成・更新
git checkout -b docs/ai-generated-api-docs
# AI promptを使ってAPI documentation生成
# 例: "Generate OpenAPI documentation for this Express.js API"
git add docs/api.md
git commit -m "docs: generate API documentation
Generated with AI assistance:
- OpenAPI 3.0 specification
- Endpoint descriptions
- Request/response examples
- Error handling documentation
Manual review completed:
- Verified accuracy
- Added security considerations
- Updated authentication details"セキュリティを開発プロセスの中心に置いたワークフロー。
# セキュリティブランチでの開発
git checkout -b security/implement-oauth2
# セキュリティ要件を明文化
echo "Security Requirements:" > SECURITY_REQUIREMENTS.md
echo "- OAuth 2.0 with PKCE" >> SECURITY_REQUIREMENTS.md
echo "- Rate limiting: 100 req/min" >> SECURITY_REQUIREMENTS.md
echo "- Input validation on all endpoints" >> SECURITY_REQUIREMENTS.md
git add SECURITY_REQUIREMENTS.md
git commit -m "security: define OAuth2 implementation requirements"# .github/workflows/security-scan.yml
name: Security Scan
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: SAST Scan
uses: github/codeql-action/init@v2
- name: Dependency Check
uses: dependency-check/Dependency-Check_Action@main
- name: Container Security Scan
uses: aquasecurity/trivy-action@master# セキュリティ変更のトラッキング
git commit -m "security: implement password hashing with bcrypt
Security Impact Analysis:
- Passwords now hashed with bcrypt (cost: 12)
- Removed plaintext password storage
- Added password strength validation
- Implemented secure session management
Compliance:
- OWASP Authentication Cheat Sheet ✅
- NIST Password Guidelines ✅
- GDPR data protection requirements ✅
Penetration Testing: Required
Security Review: @security-team"複数サービス間の依存関係を管理する開発フロー。
# マイクロサービス統合ブランチ
git checkout -b integration/user-order-services
# Docker Compose for integration testing
echo "version: '3.8'" > docker-compose.integration.yml
echo "services:" >> docker-compose.integration.yml
echo " user-service:" >> docker-compose.integration.yml
echo " build: ./user-service" >> docker-compose.integration.yml
echo " order-service:" >> docker-compose.integration.yml
echo " build: ./order-service" >> docker-compose.integration.yml
git add docker-compose.integration.yml
git commit -m "integration: add user-order services integration test
Changes:
- Add integration test environment
- Configure service mesh communication
- Add contract testing with Pact
- Implement distributed tracing
Testing Strategy:
- Unit tests: Each service
- Integration tests: Service pairs
- E2E tests: Full user journey
- Contract tests: API compatibility"# API契約変更管理
git checkout -b api/update-user-service-v2
# OpenAPI specification更新
# Contract testing設定更新
# Backward compatibility確認
git add api-specs/
git commit -m "api: update user service API to v2.1
Breaking Changes: None
New Features:
- Add user preferences endpoint
- Add batch user update
- Add user activity logging
Backward Compatibility:
- v2.0 endpoints maintained
- New optional fields only
- Deprecation warnings added
Contract Testing:
- All existing contracts pass ✅
- New contracts added for v2.1 ✅
- Consumer impact analysis completed ✅"完全自動化されたデプロイメントパイプライン。
# 環境ごとのプロモーション
git checkout main
git pull origin main
# Development環境へのデプロイ(自動)
git push origin main # → development環境に自動デプロイ
# Staging環境へのプロモーション
git checkout staging
git merge main
git push origin staging # → staging環境に自動デプロイ
# Production環境へのプロモーション(手動承認)
git checkout production
git merge staging
git tag -a release-$(date +%Y%m%d-%H%M%S) -m "Production release $(date)"
git push origin production --tags # → production環境に自動デプロイ(承認後)# .github/workflows/canary-deploy.yml
name: Canary Deployment
on:
push:
branches: [production]
jobs:
canary-deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy to Canary (5% traffic)
run: |
kubectl apply -f k8s/canary/
kubectl patch service myapp -p '{"spec":{"selector":{"version":"canary"}}}'
- name: Monitor Canary Metrics
run: |
# 5分間メトリクス監視
sleep 300
- name: Promote to Full Production
if: success()
run: |
kubectl patch service myapp -p '{"spec":{"selector":{"version":"stable"}}}'
kubectl scale deployment myapp-canary --replicas=0# 緊急ロールバック
git checkout production
git revert HEAD --no-edit
git push origin production
# 自動ロールバック (監視システム連携)
git commit -m "revert: emergency rollback due to high error rate
Rollback Trigger:
- Error rate > 5% for 2 minutes
- Response time > 2s for 5 minutes
- Health check failures
Rollback Actions:
- Revert to previous stable version
- Database migrations: No rollback needed
- Cache: Cleared
- CDN: Purged
Post-Rollback:
- Incident report: #INC-2025-001
- Root cause analysis: Scheduled
- Fix implementation: In progress"| プロジェクト種類 | 推奨フロー | 理由 |
|---|---|---|
| 個人プロジェクト | 個人開発フロー + AI支援 | シンプルで効率的 |
| スタートアップ | GitHub Flow + DevOps統合 | 迅速な開発・デプロイ |
| アジャイルチーム | アジャイル開発フロー | スプリントベース開発 |
| リモートチーム | リモートワーク対応フロー | 非同期コラボレーション |
| エンタープライズ | セキュリティファースト + 継続的デプロイ | 厳格な管理・自動化 |
| マイクロサービス | マイクロサービス開発フロー | サービス間連携管理 |
| オープンソース | OSS貢献フロー + AI支援 | フォークベース + 効率化 |
AI支援を明記:
feat: implement user authentication with AI assistance
Generated with GitHub Copilot:
- Basic authentication flow
- JWT token handling
- Password validation
Manual enhancements:
- Security hardening
- Error handling
- Unit tests
- Documentation
Co-authored-by: GitHub Copilot <copilot@github.com>
セキュリティチェックリスト:
- 入力値検証実装済み
- 認証・認可チェック済み
- シークレット情報ハードコードなし
- 依存関係脆弱性チェック済み
- SAST/DAST スキャン実行済み
非同期レビューのポイント:
- 詳細な変更説明
- スクリーンショット・デモ動画
- タイムゾーンを考慮したレビュー期限
- 明確な質問・フィードバック
📈 AI Project Manager による最終更新: 2025-10-22 バージョン: 2.0.0 - Modern Development Workflows Edition