git-flowを導入されていない環境にgit-flowを導入して 開発フローをつくる方法についての情報は多くありますが すでにgit-flowを導入して開発を進めているリポジトリに、 後から新しいメンバが参加する方法についてはあまり情報が ないようでしたので、投稿します。
ここでは既にgit-flowを導入して開発をすすめているtestsite
というリポジトリのプロジェクトにAさんが参加する場合を想定して
解説しています。
- インストール先: Aさんの開発用PC
Macの場合:
$ brew install git-flow
Linux(Ubunts)の場合:
$ sudo apt-get install git-flow
- クローン先: Aさんの開発用PC
$ git clone git@github.com:hoge/testsite.git
$ cd testsite
- Aさんの開発用PCで作業をして下さい。
失敗例:
$ git branch -a
* develop <- すでにdevelopブランチがある
remotes/origin/HEAD -> origin/develop
remotes/origin/develop
remotes/origin/master
$ git flow init -d
Using default branch names.
Which branch should be used for bringing forth production releases?
- develop
Branch name for production releases: []
Local branch '' does not exist.
まだgit-flowをつかっていない環境では通常はmasterブランチしかないのでこのタイミングでgit flow inti -d
コマンドを実行するだけでOKなのですが、git-flowをすでに使っている環境ではうまくいきません。
少なくとも、masterリポジトリとdevelopリポジトリはリモートリポジトリから取り込んでおく必要があるようです。
masterリポジトリとdevelopリポジトリがすでに存在している場合の手順:
$ git branch -a
* develop <- すでにdevelopブランチがある
remotes/origin/HEAD -> origin/develop
remotes/origin/develop
remotes/origin/master
$ git checkout -b master origin/master
Branch master set up to track remote branch master from origin.
Switched to a new branch 'master'
$ git branch -a
develop
* master
remotes/origin/HEAD -> origin/develop
remotes/origin/develop
remotes/origin/master
[kshatriya@bbtsite]$ git flow init -d
Using default branch names.
Which branch should be used for bringing forth production releases?
- develop
- master
Branch name for production releases: [master]
Which branch should be used for integration of the "next release"?
- develop
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? []
[kshatriya@bbtsite]$ git branch -a
develop
* master
remotes/origin/HEAD -> origin/develop
remotes/origin/develop
remotes/origin/master