Git flow まとめ
git flow init -d
developブランチが作られ切り替えられる。
git-flowは、git-flowのブランチの設定情報をGitリポジトリ上に保持できないため、リポジトリ管理者だけでなく担当者のリポジトリでも上記コマンドでリポジトリを初期化する必要がある。
git flow feature start [ブランチ名]
git flow release start [ブランチ名 e.g. v1.1]
developブランチからreleaseブランチが作られる。
git flow hotfix start [ブランチ名]
masterブランチからhotfixブランチが作られる。
git flow [ブランチ種別] publish [ブランチ名]
featureブランチmyfeatを共有する場合
git flow feature publish myfeat
git flow {ブランチ種別} track {ブランチ名}
featureブランチmyfeatを取得する場合
git flow feature track myfeat
既にブランチを取り込んでいる場合は、プルでコミットを取り込み
git flow feature pull
必要があればrebase
git flow {ブランチ種別} rebase
git push
普通のgitと同じ
git flow {ブランチ種別} pull origin
git flow {ブランチ種別} rebase
必要に応じてrebase
git flow {ブランチ種別} finish {ブランチ名}
ちなみにfeatureをfinishしたあとにリモートへプッシュしたときリモートが更新されていると、コンフリクトを解消rebaseとかするとブランチの分岐がfeatureをfinishしたときと異なってしまう。かといって最初の分岐を再現するためのブランチはfinishによって削除されている、という現象を回避するためにkオプションをつけてブランチを削除されないようにすることができる。
git flow feature finish -k cool-feature
git push --all
git flow feature finish myfeat
featureブランチがdevelopブランチにマージされ、カレントブランチがdevelopになる。
featureブランチは削除される。
git flow release finish v1.1
releaseブランチがmaster、developブランチにマージされ、ブランチ名がタグとして付与される。
releaseブランチは削除される。
あとはブランチとタグをpush
git push origin develop
git push origin master
git push origin v1.1
git flow hotfix finish v1.1.2
hotfixブランチがmaster、developブランチにマージされ、ブランチ名がタグとして付与される。
hotfixブランチは削除される。