Weitere ähnliche Inhalte Ähnlich wie Build insider offline session チームでのgit (20) Mehr von Tadahiro Ishisaka (20) Kürzlich hochgeladen (10) Build insider offline session チームでのgit34. 35
A successful Git braching model
• Vincent Driessen 著
• http://nvie.com/posts/a-successful-git-branching-model/
• 日本語訳
見えないチカラ: A successful Git branching model を翻訳しま
した
• ブランチを大きく二つに分ける
• メインブランチ
• サポートブランチ
• git-flow
• サポートツール(今日のデモでは使いません)
35. 36
A successful Git braching model
• ブランチを大きく二つに分ける
• メインブランチ
• 共有リポジトリに永久に存在する
• master
• develop
• サポートブランチ
• 使い終わったら削除する
• Feature braches
• Release braches
• Hotfix branches
masterdevelo
p
featur
e
hotfixrelease
39. 40
feature brache
• 分岐元:develop, マージ先:develop
• ブランチ名の慣習:
master, develop, release-*, hotfix-* 以外なら全て
• トピックブランチとも
• 次回リリースに入るような新しい機能開発に使われる
• 1機能1ブランチ
• その機能開発期間が寿命
• 最終的にはdevelopにマージする
develo
p
featur
e
40. 41
feature brach
• ブランチの作成
$ git checkout -b myfeature develop
• ブランチをdevelopにマージして、共有リポジトリにpush
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff myfeature ← --no-ffオプションでfeatureの存在を残す
Updating ea1b82a..05e9557
(Summary of changes)
$ git branch -d myfeature ← featureを削除する
Deleted branch myfeature (was 05e9557).
$ git push origin develop ← 共有リポジトリにpush
42. 43
release branch
• 分岐元:develop, マージ先:developとmaster
• ブランチ名の慣習: release-*
• 新しい製品のリリースをサポートする
• マイナーなバグフィックス→大きな変更をここでしてはならない
• リリースのためのメタデータの準備
• 埋め込むリリース番号、ビルド番号の調整
• ビルド日時の調整
• 次のようなタイミングでdevelopから分岐
• developが次リリースに必要な機能がおおむねマージされている
• 次リリースに正式なバージョン番号が与えられた
masterdevelo
p
release
43. 44
release branch
• release branchの作成
$ git checkout -b release-1.2 develop
Switched to a new branch "release-1.2"
$ ./bump-version.sh 1.2 ← リリースのためのメタデータ処理
Files modified successfully, version bumped to 1.2.
$ git commit -a -m "Bumped version number to 1.2"
[release-1.2 74d9424] Bumped version number to 1.2
1 files changed, 1 insertions(+), 1 deletions(-)
44. 45
release branch
• release branchの終了
$ git checkout master
Switched to branch 'master'
$ git merge --no-ff release-1.2← --no-ffオプションでreleaseの存在を残す
Merge made by recursive.
(Summary of changes)
$ git tag -a 1.2
$ git checkout develop ← 必要に応じdevelopにmerge
$ git merge --no-ff release-1.2
$ git branch -d release-1.2 ← 最終的に削除
• 本当にリリースされても良い状態になったら終了する
• masterにマージ後tagを付ける
45. 46
hotfix branch
• 分岐元:master, マージ先:developとmaster
• ブランチ名の習慣: hotfix-*
• バグフィックス用のブランチ
• 特定の製品バージョンに対するブランチ
• バージョンでタグづけされた位置からのブランチ
• このブランチにより機能開発のメンバー
(develop)とは別のメンバーが並行してバグ修正
の作業をする事が出来る
• それにdevelopが安定しているとは言いがたい
master hotfix
46. 47
hotfix branch
• hotfix branchの作成
$ git checkout -b hotfix-1.2.1 master
$ <バージョン番号などの修正>
$ git commit -a -m "Bumped version number to 1.2.1"
[hotfix-1.2.1 41e61bb] Bumped version number to 1.2.1
1 files changed, 1 insertions(+), 1 deletions(-)
$ <バグの修正>
$ git commit -m "Fixed severe production problem“
修正のコミット
47. 48
hotfix branch
• hotfix branchの終了
$ git checkout master
Switched to branch 'master'
$ git merge --no-ff hotfix-1.2.1
Merge made by recursive.
(Summary of changes)
$ git tag -a 1.2.1 ←修正後のタグを付ける
$ git checkout develop ← ↓修正をdevelopにも反映する
$ git merge --no-ff hotfix-1.2.1
※このときリリースブランチがあれば、そちらに反映する
$ git branch -d hotfix-1.2.1
49. 50
A successful Git branching modelは絶対か?
• いいえ
• プロジェクトに適切なブランチ戦略を
• Fork, PullRequest前提(GitHub)とした場合のブランチ戦略
• masterはdevelopなのか
• Deployはどこから?
• deployブランチを追加するか、masterをdeployするのか
• CIツール連携、ビルドツール
• バイナリの取り扱い
• ライブラリはリポジトリに含めるのか、NuGetは?(今ならいいのか)
• TFS
• Gitで何をしたいのか?
52. 53
参考文献
• Gitによるバージョン管理
• 岩松 信洋 上川 純一 まえだこうへい 小川 伸一郎著
• オーム社
• ISBN 978-4-2740-6864-5
• Pro Git(翻訳 Web版)
• Scott Chacon 著
• http://git-scm.com/book/ja
53. 54
参考文献
• 開発ツール徹底攻略
• 江口和宏 大塚弘記 他著
• 技術評論社
• ISBN 978-4-7741-5616-3
• A successful Git branching model
• Vincent Driessen 著
• http://nvie.com/posts/a-successful-git-branching-model/
• http://keijinsonyaban.blogspot.jp/2010/10/successful-git-
branching-model.html(翻訳)