git flow hotfix の利用

📅 2013/05/17

git git flow

git flow hotfixがしっくりこなかったのでダミーリポジトリで調査してみた。

git flow hotfixではstartの後に指定したものがそのままタグ名になり branchにはデフォルトのままだとhotfixのprefixが付与される。 (自分は勝手につくと思い込んでた)

initしてみる

$ git flow init

Which branch should be used for bringing forth production releases?
   - master
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? [] release/

branch確認

$ git branch
  develop
* hotfix/fix_nullpo
  master

fix完了

$ git flow hotfix finish fix_nullpo                                                                                                                       
error: Cannot delete the branch 'hotfix/fix_nullpo' which you are currently on.

Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- The hotfix was tagged 'release/fix_nullpo'
- Hotfix branch has been back-merged into 'develop'
- Hotfix branch 'hotfix/fix_nullpo' has been deleted

branch確認

$ git branch
  develop
* hotfix/fix_nullpo
  master

tag確認

git tag
release/fix_nullpo

hotfixのものにreleaseで指定したprefixがつくということはrelease=hotfixという認識で問題なさそうだ。

Git flowの活用事例の利用例で

上司「不具合の発生数を集計してください」

grep tag | grep "fix/" | wc -l

と出ているがreleaseのprefixにreleaseとか入れちゃうとちょっと紛らわしくなるので 何も入れずにgit flow hotfix startの時にfix/を入れてみようと思う。

余談だけどタグはcpみたいな扱いしかできずfix/のprefixつけ忘れたものの付け替えはセルフサービスになるのね。

$ git tag fix/gatsu gatsu
$ git tag -d gatsu