git flow學(xué)習(xí)
一、創(chuàng)建develop分支
- 本地創(chuàng)建一個(gè)空的develop分支并push到遠(yuǎn)程倉(cāng)庫(kù)
- 此時(shí)會(huì)有master主分支和develop主分支
二、A和B兩人進(jìn)行功能開(kāi)發(fā)
- 從develop主分支分別拉develop_issuesA和develop_issuesB,表示A和B進(jìn)行兩個(gè)功能的開(kāi)發(fā)
- 若A功能開(kāi)發(fā)完成準(zhǔn)備發(fā)布:
- 先從develop上merge代碼到develop_issuesA上,防止其他開(kāi)發(fā)者往develop主分支合并過(guò)代碼造成沖突
- 將develop_issuesA合并到develop主分支
- 新建一個(gè)基于develop_issuesA的develop_issuesA_0.0.1發(fā)布分支用于發(fā)布前的準(zhǔn)備,測(cè)試,文檔更新等,此時(shí)確定版本號(hào),一旦版本號(hào)確定下來(lái),不允許有任何的改動(dòng)
- 測(cè)試完成后,將發(fā)布分支分別合并到master主分支和develop主分支,無(wú)論什么時(shí)候合并入master都必須打上標(biāo)簽tag
- 刪除發(fā)布分支develop_issuesA_0.0.1
- 若上線版本有bug
- 誰(shuí)的功能出現(xiàn)bug就讓誰(shuí)去基于master創(chuàng)建一個(gè)用于修復(fù)的分支
- 修復(fù)完成后將修復(fù)分支分別合并到master主分支和develop主分支中
三、git flow的使用
-
初始化:
git flow init -
開(kāi)始新Feature:
git flow feature start MYFEATURE -
Publish一個(gè)Feature(也就是push到遠(yuǎn)程):
git flow feature publish MYFEATURE -
獲取Publish的Feature:
git flow feature pull origin MYFEATURE -
完成一個(gè)Feature:
git flow feature finish MYFEATURE -
開(kāi)始一個(gè)Release:
git flow release start RELEASE [BASE] -
Publish一個(gè)Release:
git flow release publish RELEASE -
發(fā)布Release:
git flow release finish RELEASE
別忘了git push --tags -
開(kāi)始一個(gè)Hotfix:
git flow hotfix start VERSION [BASENAME] -
發(fā)布一個(gè)Hotfix:
git flow hotfix finish VERSION -
示意圖:示意圖
四、git flow的安裝
- 下載三個(gè)所需文件getopt.exe、libint13.dll、libiconv2.dll,將文件復(fù)制到到Git目錄的bin下面
- 從github上clone Gitflow:
git clone --recursive git://github.com/nvie/gitflow.git - 使用管理員權(quán)限打開(kāi)cmd,然后進(jìn)行g(shù)itflow文件夾中,使用
contrib\msysgit-install.cmd "C:\Program Files\Git"啟動(dòng)git
五、git flow可視化工具
- SourceTree
- Git flow for visual studio
參考博客:
(http://www.cnblogs.com/cnblogsfans/p/5075073.html)
(http://www.ituring.com.cn/article/56870)
