これがすごい分かりやすかったので、 素の git と git-flow によって同じことを写経してみました。
$ mkdir git-no-flow-test
$ git init
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
$ mkdir git-flow-test
$ git flow init
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag =
core は同じで、サブモジュールで管理してるんですね。
これは同じだから省略。 それぞれに readme.txt を入れてあるのです。
$ git branch feature/spam
$ git branch
feature/spam
* master
$ git checkout feature/spam
Switched to branch 'feature/spam'
$ git branch
* feature/spam
master
$ git flow feature start spam
Switched to a new branch 'feature/spam'
Summary of actions:
- A new branch 'feature/spam' was created, based on 'develop'
- You are now on branch 'feature/spam'
Now, start committing on your feature. When done, use:
git flow feature finish spam
$ git branch
develop
* feature/spam
master
自分のように慣れてない人には分かりやすく、慣れちゃった人は驚いてしまう感じです。
まあ、これも省略で。 ついでにコミットしておきます。
$ git branch
* feature/spam
master
$ git checkout master
Switched to branch 'master'
$ git merge feature/spam
Updating 6d16ede..6a0a67c
Fast-forward
readme.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
$ git branch -d feature/spam
Deleted branch feature/spam (was 6a0a67c).
$ git branch
* master
$ git flow feature finish spam
Switched to branch 'develop'
Updating 3db4f92..d7cfe7f
Fast-forward
readme.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
Deleted branch feature/spam (was d7cfe7f).
Summary of actions:
- The feature branch 'feature/spam' was merged into 'develop'
- Feature branch 'feature/spam' has been removed
- You are now on branch 'develop'
$ git branch
* develop
master
コマンド一発。これも慣れていない人には (ry
$ git branch release/1.0
$ git checkout release/1.0
Switched to branch 'release/1.0'
$ git branch
master
* release/1.0
$ git commit -m 'aaa'
[release/1.0 c83055a] aaa
1 files changed, 1 insertions(+), 0 deletions(-)
$ git checkout master
Switched to branch 'master'
$ git merge release/1.0
Updating 6a0a67c..c83055a
Fast-forward
readme.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
$ git tag -a 1.0 -m 'release 1.0'
$ git tag
1.0
$ git branch -d release/1.0
Deleted branch release/1.0 (was c83055a).
$ git branch
* master
$ git flow release start 1.0
Switched to a new branch 'release/1.0'
Summary of actions:
- A new branch 'release/1.0' was created, based on 'develop'
- You are now on branch 'release/1.0'
Follow-up actions:
- Bump the version number now!
- Start committing last-minute fixes in preparing your release
- When done, run:
git flow release finish '1.0'
$ git branch
develop
master
* release/1.0
$ git commit -m 'aaa'
$ git flow release finish 1.0
Switched to branch 'master'
Merge made by recursive.
readme.txt | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 151 insertions(+), 0 deletions(-)
create mode 100644 readme.txt
switched to branch 'develop'
Merge made by recursive.
readme.txt | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
Deleted branch release/1.0 (was 739bc2c).
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
$ git tag
1.0
$ git branch
* develop
master
圧倒的に楽チンなんですけどどうなってるのこれ。変更が単純だからだと思うけど。 本当はマージ地獄なんでしょうねきっと。
$ git branch hotfix/1.1
$ git checkout hotfix/1.1
Switched to branch 'hotfix/1.1'
$ git branch
* hotfix/1.1
master
$ touch fake.txt
$ git add fake.txt
$ git commit -m 'add fake file'
[hotfix/1.1 aa4167c] add fake file
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 fake.txt
$ git checkout master
Switched to branch 'master'
$ git merge hotfix/1.1
Updating c83055a..aa4167c
Fast-forward
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 fake.txt
$ git tag -a 1.1 -m 'hotfix 1.1'
$ git branch -d hotfix/1.1
Deleted branch hotfix/1.1 (was aa4167c).
$ git branch
* master
$ git tag -l
1.0
1.1
$ git flow hotfix start 1.1
Switched to a new branch 'hotfix/1.1'
Summary of actions:
- A new branch 'hotfix/1.1' was created, based on 'master'
- You are now on branch 'hotfix/1.1'
Follow-up actions:
- Bump the version number now!
- Start committing your hot fixes
- When done, run:
git flow hotfix finish '1.1'
$ git branch
develop
* hotfix/1.1
master
$ touch fake.txt
$ git add fake.txt
$ git commit -m 'add fake file'
[hotfix/1.1 ca403cd] add fake file
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 fake.txt
$ git flow hotfix finish 1.1
Switched to branch 'master'
Merge made by recursive.
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 fake.txt
Switched to branch 'develop'
Merge made by recursive.
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 fake.txt
Deleted branch hotfix/1.1 (was ca403cd).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- The hotfix was tagged '1.1'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/1.1' has been deleted
$ git branch
* develop
master
$ git tag -l
1.0
1.1
なるほど。release と同じだけど使う場面が違うのかな。