SourceTree?を使って Git Flowを動かしてみて、Git Flowの開発フローを整理してみました。 SourceTree?でGit Flowを実施するには、基本的には何かしようとしたら右上にある Git FlowのアイコンをクリックすればOKです。そのときに応じた、Git Flowのコマンドを実行することができます。 初回のみ †Git Flow開始時 †git 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? [] Completed successfully チケット対応開始時 †新規フィーチャー dev_50 の開始 †git feature start dev_50 Switched to a new branch 'feature/dev_50' Summary of actions: - A new branch 'feature/dev_50' was created, based on 'develop' - You are now on branch 'feature/dev_50' Now, start committing on your feature. When done, use: git flow feature finish dev_50 Completed successfully 開発! †開発します。仮想的に下記の二つをコミットして、リモートにプッシュしておきます。 下記は実際に自分で実行したコマンド。 $ git commit --allow-empty -m '#50 start.' [feature/dev_50 ec9378f] #50 start. $ git commit --allow-empty -m '#50 end.' [feature/dev_50 9ef6661] #50 end. $ git push origin feature/dev_50 Counting objects: 2, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 280 bytes | 0 bytes/s, done. Total 2 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1), done. To https://github.com/masatomix/git-flow-sample.git * [new branch] feature/dev_50 -> feature/dev_50 $ 現在のブランチ(フィーチャー)の終了 †git feature finish -k dev_50 ← -k はローカルブランチを残す設定(削除を選んだら、-kはつかなかった) Switched to branch 'develop' Your branch is up-to-date with 'origin/develop'. Already up-to-date! Merge made by the 'recursive' strategy. Summary of actions: - The feature branch 'feature/dev_50' was merged into 'develop' - Feature branch 'feature/dev_50' is still available - You are now on branch 'develop' Completed successfully リリース開始時 †各種チケット対応はいったん停止し、リリース準備作業にはいります。 新規リリースの開始 †↓間違えないように「新規リリースを開始」を選択 git release start 0.0.2 Branches 'develop' and 'origin/develop' have diverged. And local branch 'develop' is ahead of 'origin/develop'. Switched to a new branch 'release/0.0.2' Summary of actions: - A new branch 'release/0.0.2' was created, based on 'develop' - You are now on branch 'release/0.0.2' Follow-up actions: - Bump the version number now! - Start committing last-minute fixes in preparing your release - When done, run: git flow release finish '0.0.2' Completed successfully リリース準備作業! †仮想的なリリース準備作業としてこんなコミットとプッシュを。 下記は実際に自分で実行したコマンド。 $ git commit --allow-empty -m 'release 0.0.2 start.' [release/0.0.2 5a65a48] release 0.0.2 start. $ git commit --allow-empty -m 'release 0.0.2 end.' [release/0.0.2 0759703] release 0.0.2 end. $ git push origin release/0.0.2 Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 440 bytes | 0 bytes/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: Resolving deltas: 100% (2/2), done. To https://github.com/masatomix/git-flow-sample.git * [new branch] release/0.0.2 -> release/0.0.2 $ リリースの完了(UI上は、ブランチの終了) †git release finish -k -f /var/folders/fp/ph0q_b6s64v9pmpbn8x547400000gp/T/SourceTreeTemp.nX6rDe 0.0.2 Branches 'develop' and 'origin/develop' have diverged. And local branch 'develop' is ahead of 'origin/develop'. Switched to branch 'master' Switched to branch 'develop' Your branch is up-to-date with 'origin/master'. Already up-to-date! Merge made by the 'recursive' strategy. Your branch is ahead of 'origin/develop' by 3 commits. (use "git push" to publish your local commits) Already up-to-date! Merge made by the 'recursive' strategy. Summary of actions: - Latest objects have been fetched from 'origin' - Release branch has been merged into 'master' - The release was tagged '0.0.2' - Release branch has been back-merged into 'develop' - Release branch 'release/0.0.2' is still available Completed successfully コミットグラフは以下のようになりました。 流れをまとめると、以下の通り。
ローカルの変更をGitHubへプッシュ †最後に develop master ブランチとタグ 0.0.2 をリモートへプッシュして、作業完了です。 下記は実際に自分で実行したコマンド。 $ git push origin develop Counting objects: 1, done. Writing objects: 100% (1/1), 242 bytes | 0 bytes/s, done. Total 1 (delta 0), reused 0 (delta 0) To https://github.com/masatomix/git-flow-sample.git aa3dca8..f749970 develop -> develop $ git push origin master Counting objects: 1, done. Writing objects: 100% (1/1), 234 bytes | 0 bytes/s, done. Total 1 (delta 0), reused 0 (delta 0) To https://github.com/masatomix/git-flow-sample.git aa3dca8..63ad35a master -> master $ $ git tag 0.0.2 $ git push origin 0.0.2 Counting objects: 1, done. Writing objects: 100% (1/1), 171 bytes | 0 bytes/s, done. Total 1 (delta 0), reused 0 (delta 0) To https://github.com/masatomix/git-flow-sample.git * [new tag] 0.0.2 -> 0.0.2 $ 以上お疲れ様でした。 関連リンク †この記事は 現在のアクセス:5179 |