LoginSignup
44
62

More than 5 years have passed since last update.

Gitのdevelopでの作業について

Posted at

概要

下記を参考にdevelopブランチでやることをまとめた。
masterとかreleaseとかの作業については記していません。
今回話すのは赤い下線の部分について
git-model@2x.png

ブランチの説明

featureブランチ

新機能の開発はfeature-hogehogeブランチで行う。feature-hogehogeブランチはリモートブランチにプッシュせず、developブランチにマージしてプッシュする。

hotfixブランチ

masterで発生したバグの修正はhotfix-hogehogeブランチで行う。hotfix-hogehogeブランチはリモートブランチにプッシュせず、masterブランチにマージしてプッシュしたのちにdevelopブランチにもマージを行いdevelopブランチにプッシュする。

手順

新機能の場合

コマンド 意味
git checkout develop developブランチに移動
git pull origin develop developブランチを更新
git checkout -b feature-[task_name] developブランチから新しいブランチを生成してそのブランチにチェックアウト
[add → commit → add → commit →...] ブランチ内で新機能開発
git checkout develop developブランチに移動
git pull origin develop developブランチを更新
git merge --no-ff feature-[task_name] 作った新機能をマージする。このときに必ずコミットメッセージを残す(--no-ff)
git push origin develop developブランチにプッシュ

master側で起きたバグの修正の場合

コマンド 意味
git checkout master masterブランチに移動
git pull origin master masterブランチを更新
git checkout -b hotfix-[bug_name] masterブランチから新しいブランチを生成してそのブランチにチェックアウト
[add → commit → add → commit →...] ブランチ内でバグの修正
git checkout master masterブランチに移動
git merge --no-ff hotfix-[bug_name] バグを修正したものをマージし、このときに必ずコミットメッセージを残す(--no-ff)
git push origin master マスターにプッシュする
git checkout develop 同上
git merge --no-ff hotfix-[bug_name] 同上
git push origin develop 同上

おそらくこれでうまくいくんでなかろうか。

44
62
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
44
62