gitflow架构说明

129 阅读2分钟

分支說明

主要分兩種 主分支 和 支援性分支

●    主分支 : 分支階層為單層,分支永久保留

○    develop : 當 featurebranches 開發完成後,提供 Howard 測試時,請合併到此,此分支不做任何的程式修改和變更集,只接受 master 和 featurebranches 的合併

○    master : 永遠處在production-ready 狀態

●    支援性分支 : 分支階層為雙層,合併後且沒使用可刪除

○    feature branches : 新功能開發,分支的建立都以master 為來源

○    hotfix branches : 臨時需修改的bug 或 master 的 resource 更新,分支的建立都以 master 為來源 

○    release branches: 提供Marketing 測試,預計要上線的版本,分支的建立都以 master 為來源,並在合併要測試的 feature branches,合併完成後請設定 Tag,Tag的內容為合併的 feature branches


分支的來源和合併

图片

****\


●    主分支

○    develop

■    來源 : master, featurebranches

■    合併 : 無

○    master

■    來源 : 無

■    合併 : release branches,develop

●    支援性分支 : 分支階層為雙層

○    feature branches

■    來源 : master

■    合併 : release branches,develop

○    hotfix branches

■    來源 : master

■    合併 : release branches,develop, master

○    release branches

■    來源 : master, featurebranches

■    合併 : master


支援性分支命名

●    feature branches : 依功能命名

○    ex: 開發的新功能為FeedbackDashboard,請命名為 feature/FeedbackDashboard

●    hotfix branches : 依修改的 bug 命名

○    ex: 修改 Invoice 的顯示錯誤,請命名為hotfix/Invoice

●    release branches : 因為合併多個feature branch,需依日期命名

○    ex: release/20171013


Git 常用指令

請安裝 Git Windows : git-scm.com/download/wi…

●    分支合併

○    git merge feature/xxx--no-ff

○    :ws!

●    同步遠端分支

○    git remote update

○    git remote update origin--prune

●    加入 dll 到 Git

○    git add xxx.dll -f

●    還原本機所有變更集

○    git reset --hard HEAD~

●    建立 Tag

○    git tag -a tagName

●    同步 Tag 到遠端

○    git push origin tagName

●    查詢 Tag 的內容

○    git show tagName

●    刪除 Tag

○    git push -d origin tagname

○    git -d tagname