16. git-flow
- A successful Git branching model のモデルを運用しやすくするプラグ
イン
- https://github.com/nvie/gitflow
- git-flowのセットアップ(Windows/Linux/Mac)
- http://www.oreilly.co.jp/community/blog/2011/11/branch-model-
with-git-flow.html
17. git-flowの実行
- リポジトリとブランチを作成する
$ git flow init
Initialized empty Git repository in /Users/naomichi/Desktop/
testrep/.git/
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master]
Branch name for "next release" development: [develop]
How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
$ git branch -a
* develop
master
18. git-flowの実行
- リポジトリとブランチを作成する
$ git flow init
Initialized empty Git repository in /Users/naomichi/Desktop/
testrep/.git/
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master]
Branch name for "next release" development: [develop]
masterブランチ、featureブランチを命名
How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
$ git branch -a
* develop
master
19. git-flowの実行
- リポジトリとブランチを作成する
$ git flow init
Initialized empty Git repository in /Users/naomichi/Desktop/
testrep/.git/
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master]
Branch name for "next release" development: [develop]
masterブランチ、featureブランチを命名
How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
$ git branch -a
* develop
master
featureブランチは表示されない(後述)
20. featureブランチの作成 1/2
- 新機能の開発を開始する
$ echo 'hello' > greeting
$ git add .
$ git commit -m "first commit"
$ git flow feature start 100
Switched to a new branch 'feature/100'
Summary of actions:
- A new branch 'feature/100' was created, based on 'develop'
- You are now on branch 'feature/100'
Now, start committing on your feature. When done, use:
git flow feature finish 100
$ git branch
develop
* feature/100
master
21. featureブランチの作成 1/2
- 新機能の開発を開始する
$ echo 'hello' > greeting Redmine#100の開発を開始
$ git add .
$ git commit -m "first commit"
$ git flow feature start 100
Switched to a new branch 'feature/100'
Summary of actions:
- A new branch 'feature/100' was created, based on 'develop'
- You are now on branch 'feature/100'
Now, start committing on your feature. When done, use:
git flow feature finish 100
$ git branch
develop
* feature/100
master
22. featureブランチの作成 1/2
- 新機能の開発を開始する
$ echo 'hello' > greeting Redmine#100の開発を開始
$ git add .
$ git commit -m "first commit"
$ git flow feature start 100
Switched to a new branch 'feature/100'
Summary of actions:
- A new branch 'feature/100' was created, based on 'develop'
- You are now on branch 'feature/100'
Now, start committing on your feature. When done, use:
developブランチを元にfeatureブランチが作成された
git flow feature finish 100
$ git branch
develop
* feature/100
master
23. featureブランチの作成 1/2
- 新機能の開発を開始する
$ echo 'hello' > greeting Redmine#100の開発を開始
$ git add .
$ git commit -m "first commit"
$ git flow feature start 100
Switched to a new branch 'feature/100'
Summary of actions:
- A new branch 'feature/100' was created, based on 'develop'
- You are now on branch 'feature/100'
Now, start committing on your feature. When done, use:
developブランチを元にfeatureブランチが作成された
git flow feature finish 100
$ git branch
develop
* feature/100
master
ブランチが追加される
24. featureブランチの作成 2/2
- featureの開発を終わらせてdevelopに戻る(マージする)
$ echo 'good night' > greeting
$ git commit -m "second commit" -a
$ git flow feature finish 100
Switched to branch 'develop'
Updating 01f0874..58f1c0d
Fast-forward
greeting | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Deleted branch feature/100 (was 58f1c0d).
Summary of actions:
- The feature branch 'feature/100' was merged into 'develop'
- Feature branch 'feature/100' has been removed
- You are now on branch 'develop'
$ cat greeting
good night
$ git branch
* develop
master
25. featureブランチの作成 2/2
- featureの開発を終わらせてdevelopに戻る(マージする)
featureブランチの終わりを宣言
$ echo 'good night' > greeting
$ git commit -m "second commit" -a
$ git flow feature finish 100
Switched to branch 'develop'
Updating 01f0874..58f1c0d
Fast-forward
greeting | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Deleted branch feature/100 (was 58f1c0d).
Summary of actions:
- The feature branch 'feature/100' was merged into 'develop'
- Feature branch 'feature/100' has been removed
- You are now on branch 'develop'
$ cat greeting
good night
$ git branch
* develop
master
26. featureブランチの作成 2/2
- featureの開発を終わらせてdevelopに戻る(マージする)
featureブランチの終わりを宣言
$ echo 'good night' > greeting
$ git commit -m "second commit" -a
$ git flow feature finish 100
Switched to branch 'develop'
Updating 01f0874..58f1c0d
Fast-forward
greeting | 2 +- developブランチにマージされ、featureブランチが削除される
1 files changed, 1 insertions(+), 1 deletions(-)
Deleted branch feature/100 (was 58f1c0d).
Summary of actions:
- The feature branch 'feature/100' was merged into 'develop'
- Feature branch 'feature/100' has been removed
- You are now on branch 'develop'
$ cat greeting
good night
$ git branch
* develop
master
27. featureブランチの作成 2/2
- featureの開発を終わらせてdevelopに戻る(マージする)
featureブランチの終わりを宣言
$ echo 'good night' > greeting
$ git commit -m "second commit" -a
$ git flow feature finish 100
Switched to branch 'develop'
Updating 01f0874..58f1c0d
Fast-forward
greeting | 2 +- developブランチにマージされ、featureブランチが削除される
1 files changed, 1 insertions(+), 1 deletions(-)
Deleted branch feature/100 (was 58f1c0d).
Summary of actions:
- The feature branch 'feature/100' was merged into 'develop'
- Feature branch 'feature/100' has been removed
- You are now on branch 'develop'
$ cat greeting
good night developブランチにマージされたことが確認できる
$ git branch
* develop
master
28. featureブランチの作成 2/2
- featureの開発を終わらせてdevelopに戻る(マージする)
featureブランチの終わりを宣言
$ echo 'good night' > greeting
$ git commit -m "second commit" -a
$ git flow feature finish 100
Switched to branch 'develop'
Updating 01f0874..58f1c0d
Fast-forward
greeting | 2 +- developブランチにマージされ、featureブランチが削除される
1 files changed, 1 insertions(+), 1 deletions(-)
Deleted branch feature/100 (was 58f1c0d).
Summary of actions:
- The feature branch 'feature/100' was merged into 'develop'
- Feature branch 'feature/100' has been removed
- You are now on branch 'develop'
$ cat greeting
good night developブランチにマージされたことが確認できる
$ git branch
* develop featureブランチは削除済み
master
29. releaseブランチの作成 1/2
- リリースバージョンを作成
$ git flow release start 20120401
Switched to a new branch 'release/20120401'
Summary of actions:
- A new branch 'release/20120401' was created, based on
'develop'
- You are now on branch 'release/20120401'
Follow-up actions:
- Bump the version number now!
- Start committing last-minute fixes in preparing your release
- When done, run:
git flow release finish '20120401'
$ git branch
develop
master
* release/20120401
30. releaseブランチの作成 1/2
- リリースバージョンを作成
$ git flow release start 20120401 releaseブランチを開始
Switched to a new branch 'release/20120401'
Summary of actions:
- A new branch 'release/20120401' was created, based on
'develop'
- You are now on branch 'release/20120401'
Follow-up actions:
- Bump the version number now!
- Start committing last-minute fixes in preparing your release
- When done, run:
git flow release finish '20120401'
$ git branch
develop
master
* release/20120401
31. releaseブランチの作成 1/2
- リリースバージョンを作成
$ git flow release start 20120401 releaseブランチを開始
Switched to a new branch 'release/20120401'
Summary of actions:
- A new branch 'release/20120401' was created, based on
'develop'
- You are now on branch 'release/20120401'
Follow-up actions:
- Bump the version number now! developブランチを元にreleaseブランチが作成された
- Start committing last-minute fixes in preparing your release
- When done, run:
git flow release finish '20120401'
$ git branch
develop
master
* release/20120401
32. releaseブランチの作成 1/2
- リリースバージョンを作成
$ git flow release start 20120401 releaseブランチを開始
Switched to a new branch 'release/20120401'
Summary of actions:
- A new branch 'release/20120401' was created, based on
'develop'
- You are now on branch 'release/20120401'
Follow-up actions:
- Bump the version number now! developブランチを元にreleaseブランチが作成された
- Start committing last-minute fixes in preparing your release
- When done, run:
git flow release finish '20120401'
$ git branch
develop releaseブランチがアクティブになる
master
* release/20120401
33. releaseブランチの作成 2/2
- プログラムの微調整を加えた後にリリースを行う
$ echo 'good mornink'
good mornink
$ git commit -m "first commit"
$ git flow release finish 1.0
Switched to branch 'master'
Merge made by recursive.
greeting | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 greeting
create mode 100644 hello
Deleted branch release/1.0 (was 58f1c0d).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Release branch has been merged into 'master'
- The release was tagged '1.0'
- Release branch has been back-merged into 'develop'
- Release branch 'release/1.0' has been deleted
[naomichi: test]$ git tag
20120401
34. releaseブランチの作成 2/2
- プログラムの微調整を加えた後にリリースを行う
$ echo 'good mornink'
good mornink
$ git commit -m "first commit"
$ git flow release finish 1.0
Switched to branch 'master'
Merge made by recursive.
greeting | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 greeting
releaseブランチを終了し、master/developブランチにマージする
create mode 100644 hello
Deleted branch release/1.0 (was 58f1c0d).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Release branch has been merged into 'master'
- The release was tagged '1.0'
- Release branch has been back-merged into 'develop'
- Release branch 'release/1.0' has been deleted
[naomichi: test]$ git tag
20120401
35. releaseブランチの作成 2/2
- プログラムの微調整を加えた後にリリースを行う
$ echo 'good mornink'
good mornink
$ git commit -m "first commit"
$ git flow release finish 1.0
Switched to branch 'master'
Merge made by recursive.
greeting | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 greeting
releaseブランチを終了し、master/developブランチにマージする
create mode 100644 hello
Deleted branch release/1.0 (was 58f1c0d).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Release branch has been merged into 'master'
- The release was tagged '1.0'
- Release branch has been back-merged into 'develop'
- Release branch 'release/1.0' has been deleted
[naomichi: test]$ git tag
20120401 マージとmasterブランチへのタグ付けが行われた
36. hotfixブランチの作成 1/2
- リリース済みのプログラムに対し修正を加える
$ git flow hotfix start 20120401_200
Switched to a new branch 'hotfix/20120401_200'
Summary of actions:
- A new branch 'hotfix/20120401_200' was created, based on
'master'
- You are now on branch 'hotfix/20120401_200'
Follow-up actions:
- Bump the version number now!
- Start committing your hot fixes
- When done, run:
git flow hotfix finish '20120401_200'
$ git branch
develop
* hotfix/20120401_200
master
37. hotfixブランチの作成 1/2
- リリース済みのプログラムに対し修正を加える
Redmine#200のホットフィックスを開始
$ git flow hotfix start 20120401_200
Switched to a new branch 'hotfix/20120401_200'
Summary of actions:
- A new branch 'hotfix/20120401_200' was created, based on
'master'
- You are now on branch 'hotfix/20120401_200'
Follow-up actions:
- Bump the version number now!
- Start committing your hot fixes
- When done, run:
git flow hotfix finish '20120401_200'
$ git branch
develop
* hotfix/20120401_200
master
38. hotfixブランチの作成 1/2
- リリース済みのプログラムに対し修正を加える
Redmine#200のホットフィックスを開始
$ git flow hotfix start 20120401_200
Switched to a new branch 'hotfix/20120401_200'
Summary of actions:
- A new branch 'hotfix/20120401_200' was created, based on
'master'
- You are now on branch 'hotfix/20120401_200'
Follow-up actions:
- Bump the version number now! masterブランチを元にhotfixブランチを作成
- Start committing your hot fixes
- When done, run:
git flow hotfix finish '20120401_200'
$ git branch
develop
* hotfix/20120401_200
master
39. hotfixブランチの作成 1/2
- リリース済みのプログラムに対し修正を加える
Redmine#200のホットフィックスを開始
$ git flow hotfix start 20120401_200
Switched to a new branch 'hotfix/20120401_200'
Summary of actions:
- A new branch 'hotfix/20120401_200' was created, based on
'master'
- You are now on branch 'hotfix/20120401_200'
Follow-up actions:
- Bump the version number now! masterブランチを元にhotfixブランチを作成
- Start committing your hot fixes
- When done, run:
git flow hotfix finish '20120401_200'
$ git branch
develop hotfixブランチが追加される
* hotfix/20120401_200
master
40. hotfixブランチの作成 2/2
- ホットフィックスの適用
$ echo 'good night' > greeting
$ git commit -m "fixed spell" -a
# On branch hotfix/20120401_200
nothing to commit (working directory clean)
$ git flow hotfix finish 20120401_200
Switched to branch 'develop'
Already up-to-date!
Merge made by recursive.
Deleted branch hotfix/20120401_200 (was 8aeddfd).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- The hotfix was tagged '20120401_200'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/20120401_200' has been deleted
41. hotfixブランチの作成 2/2
- ホットフィックスの適用
$ echo 'good night' > greeting
$ git commit -m "fixed spell" -a
# On branch hotfix/20120401_200 スペルミスを修正してコミット
nothing to commit (working directory clean)
$ git flow hotfix finish 20120401_200
Switched to branch 'develop'
Already up-to-date!
Merge made by recursive.
Deleted branch hotfix/20120401_200 (was 8aeddfd).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- The hotfix was tagged '20120401_200'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/20120401_200' has been deleted
42. hotfixブランチの作成 2/2
- ホットフィックスの適用
$ echo 'good night' > greeting
$ git commit -m "fixed spell" -a
# On branch hotfix/20120401_200 スペルミスを修正してコミット
nothing to commit (working directory clean)
$ git flow hotfix finish 20120401_200
Switched to branch 'develop'
Already up-to-date!
Merge made by recursive. ホットフィックスを終わらせる
Deleted branch hotfix/20120401_200 (was 8aeddfd).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- The hotfix was tagged '20120401_200'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/20120401_200' has been deleted
43. hotfixブランチの作成 2/2
- ホットフィックスの適用
$ echo 'good night' > greeting
$ git commit -m "fixed spell" -a
# On branch hotfix/20120401_200 スペルミスを修正してコミット
nothing to commit (working directory clean)
$ git flow hotfix finish 20120401_200
Switched to branch 'develop'
Already up-to-date!
Merge made by recursive. ホットフィックスを終わらせる
Deleted branch hotfix/20120401_200 (was 8aeddfd).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- The hotfix was tagged '20120401_200'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/20120401_200' has been deleted
ホットフィックスをmaster/developブランチに反映