なんでもかんでもmasterにcommitしまくるのを阻止できる。
参考
準備
brewを使う場合
brew install git-flow
手動で行う場合
git clone http://github.com/nvie/gitflow.git
cd gitflow
git submodule init
git submodule update
export PATH=$PATH:`pwd`
PATHを追加することでgit flow
コマンドが使えるようになる。
また、./git-flow
を使ってもよい。
既存のリポジトリにgit-flowを使いはじめるとき
git clone ../hoge.git/
git flow init
git feature start toppage
-
git flow init
してから使い始めれば良い。- リリース用のブランチを指定(master)
- プレリリース用のブランチを指定(develop)
git flowを使う場合
git flow init
git flow feature start toppage
touch index.html
git add -A
git commit -m "トップページ"
touch header.html
git add -A
git commit -m "ヘッダ"
git flow feature finish toppage
# developブランチにマージされる。
git flow release start 20141014
git flow release finish 20141014
# masterブランチにマージされる。
コミットし忘れている場合にgit flow init
をしようとすると以下エラーが出るので安心。
fatal: Working tree contains unstaged changes. Aborting.
git flowを使わない場合
## develブランチで作業
git checkout -b devel
## いろいろ編集しコミットする。そのあと以下
git checkout メインのブランチ名
git merge devel
git branch -d devel
## push
git push origin メインのブランチ名