LoginSignup
1
3

More than 5 years have passed since last update.

現場ではじめてのGit Flow

Last updated at Posted at 2018-10-07

Qiita初投稿です!
エンジニア実務経験半年の新米エンジニアです!今の現場で初めてGit Flowを使用したので、備忘録として投稿いたします!
かなり見にくいかもしれませんが、僕みたいなビギナーの方々の参考になれれば嬉しいです!

※事前にgit flowがインストール済みであることを前提に進めていきます。

開発

  • developブランチ上で以下のコマンド(ブランチ名をfix_usernameとする)

git flow feature start fix_username

  • 作業後はコミット。プッシュ。
  • プルリクエスト作成
  • 開発がすべて終了したら以下のコマンド。fix_usernameブランチをdevelopにマージし、ブランチが削除され、developブランチにスイッチされる。

git flow feature finish fix_username

リリース

ここからリリースしていきます!

  • developブランチに移動

$ git checkout develop

  • pullしてローカルのdevelopブランチを最新にする

$ git pull

  • masterブランチに移動

$ git checkout master

  • pullしてmasterブランチを最新にする

git pull

  • masterブランチの最新のタグ名を確認

$ git describe
   v1.6.23

  • masterブランチからreleaseブランチを作成(今回は最新のタグ名の次番号にする)

git flow release start v1.6.24

  • releaseブランチが作成されているか確認

$ git branch -l
    * release/v1.6.24

  • リリース準備を終了させる

$ git flow release finish

※上記のコマンドで以下のような処理が行われる
    Summary of actions:
Release branch 'release/v1.6.24' has been merged into 'master'
The release was tagged 'v1.6.24'
Release tag 'v1.6.24' has been back-merged into 'develop'
Release branch 'release/v1.6.24' has been locally deleted
You are now on branch ‘develop'

  • releaseブランチをmasterとdevelopにマージできたら、developブランチの状態でプッシュ

git push

  • masterブランチに移動

$ git checkout master

  • masterにプッシュ

git push

  • あとは本番環境やステージング環境にデプロイする流れですね!

本番環境に上げたが、修正が必要な場合

hotfixを使用

  • masterブランチからhotfixブランチを作成

$ git flow hotfix start v1.6.28

  • 修正する

  • 修正が終わったら以下のコマンド

  $ git add -A
   $ git commit -m "delete code”
   $ git flow hotfix finish v1.6.29

  • developブランチに移動

$ git checkout develop

  • developにプッシュ

git push

  • masterブランチに移動

$ git checkout master

  • masterにプッシュ

git push

以上で終了

1
3
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
1
3