%%{ init: {
'theme': 'default',
'themeVariables': {
'fontFamily': 'Meiryo',
'commitLabelFontSize': '18px',
'tagLabelFontSize': '18px'
},
'gitGraph': {
'orientation': 'LR',
'nodeSpacing': 80,
'mainBranchName': 'main'
}
} }%%
gitGraph
commit id: "v1.0.0" tag: "v1.0.0"
branch develop
checkout develop
commit id: "next"
branch feat/login
checkout feat/login
commit id: "ui"
commit id: "api"
checkout develop
merge feat/login id: "squash"
checkout main
branch hotfix/bug
checkout hotfix/bug
commit id: "fix"
checkout main
merge hotfix/bug tag: "v1.0.1"
checkout develop
merge hotfix/bug
branch bugfix/typo
checkout bugfix/typo
commit id: "typo"
checkout develop
merge bugfix/typo
checkout main
merge develop tag: "v1.1.0"
mainから直接hotfixを切り,修正後はdevelopにも反映する
hotfix フローイメージ図
%%{ init: {
'theme': 'default',
'themeVariables': {
'fontFamily': 'Meiryo',
'commitLabelFontSize': '14px',
'tagLabelFontSize': '14px'
},
'gitGraph': {
'orientation': 'LR',
'nodeSpacing': 110,
'mainBranchName': 'main'
}
} }%%
gitGraph
commit id: "v1.0.0" tag: "v1.0.0"
branch develop
checkout develop
commit id: "next"
checkout main
commit id: "revert" tag: "v1.0.1"
branch hotfix/bug
checkout hotfix/bug
commit id: "root-fix"
checkout main
merge hotfix/bug tag: "v1.0.2"
checkout develop
merge main
hotfix 運用ルール
① まず main に revert を当てる
- 重大バグは
mainに直接git revertを当てて即 tag(前提:原因特定可・後続依存なし)で本番を最速安定化
② その後 hotfix で根本修正
mainからhotfix/*を分岐し,PR・マージ後 Annotated tag を付与(落ち着いて根本原因を直す)
③ main と develop の同期
mainで tag を打ち,同内容をdevelopに back-merge して 2 系統を同期- revert commit は履歴に残す(履歴改ざんはしない)