前提是已經安裝好git flow並做好配置。安裝指導
1 首先確定你的緊急發布應基於那個分支(默認是mater/main分支,)並切換到對應分支。
2 git flow init--該命令會只指導你基於那個分支創建hotfix分支,你的hotfix分支自動合並到哪些分支提示如下
Branch name for production releases: [master]
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? []
3 git flow hotfix start 分支名(不要加hotfix)--新建hotfix分支,成功后會自動切換
如下
git:(develop) git flow hotfix start testHotfix
切換到一個新分支 'hotfix/testHotfix'
Summary of actions:
- A new branch 'hotfix/testHotfix' was created, based on 'master'
- You are now on branch 'hotfix/testHotfix'
Follow-up actions:
- Bump the version number now!
- Start committing your hot fixes
- When done, run:
git flow hotfix finish 'testHotfix'
4 在hotfix分支修改代碼然后add和commit
5 最后執行git flow hotfix finish 分支名