LoginSignup
16
16

More than 5 years have passed since last update.

git-flowを試した

Last updated at Posted at 2014-10-13

なんでもかんでも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 メインのブランチ名
16
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
16