開發流程

在開發的過程中存在以下情況:

情況1: 開發新特性
情況2: 緊急修正生產環境中報告的Bug
情況3: 支援其他成員,幫忙調試

假如我們在master主分支中進行新特性的開發,這時如果發生情況2,處理起來比較麻煩。

正確的實踐應該是:

  • master主分支保致與對外發布的版本同步

  • 每個新特性(feature)都有獨立的分支

  • 將多個新特性(feature)分支合并至發布(release)分支

  • 待發布(release)分支完成后再合并至master主分支,正式對外發布

gitflow

gitflow是開源的標准化git流程協助工具,項目地址在 http://github.com/nvie/gitflow

(Ubuntu)

wget -q -O - --no-check-certificate https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | sudo sh

其他操作系統安裝gitflow請參考 http://github.com/nvie/gitflow

使用方法

#初始化(問時就好)
git flow init

開發新特征

git flow feature start <name> [<base>]
git flow feature finish <name>
#列出新特征分支
git flow feature

淮備發布版本

git flow release start <name> [<base>]
git flow release finish <name>
#列出布分支
git flow release

< base >是位于develop分支的commit

修正緊急Bug

git flow hotfix start <name> [<base>]
git flow hotfix finish <name>
#列出修正分支
git flow hotfix

支援其他成員工作

git flow support start <name> <base>
#finish?(實踐)
#列出支援分支
git flow support

< base >是位于master分支的commit

github

上傳未完成的feature分支

#git push REMOTENAME BRANCHNAME
#一般情REMOTENAMEorigin, BRANCHNAMEfeature/的分支名
git push origin feature/orders
注意:對于develop分支,由于所有成員的本地庫中都有,所以不能上傳

  1. A successful Git branching model

  2. Why aren’t you using git-flow?

  3. github remotes


 

arrow
arrow
    全站熱搜

    狼翔月影 發表在 痞客邦 留言(0) 人氣()