Skip to content

Instantly share code, notes, and snippets.

@seak0503
Created January 11, 2017 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seak0503/34a645c36364b8e96aec550ab34e3127 to your computer and use it in GitHub Desktop.
Save seak0503/34a645c36364b8e96aec550ab34e3127 to your computer and use it in GitHub Desktop.
git-flowを導入済みの開発環境に参加する

はじめに

git-flowを導入されていない環境にgit-flowを導入して 開発フローをつくる方法についての情報は多くありますが すでにgit-flowを導入して開発を進めているリポジトリに、 後から新しいメンバが参加する方法についてはあまり情報が ないようでしたので、投稿します。

ここでは既にgit-flowを導入して開発をすすめているtestsiteというリポジトリのプロジェクトにAさんが参加する場合を想定して 解説しています。

git-flowのインストール

  • インストール先: 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

git-flowの初期設定

  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment