-
Notifications
You must be signed in to change notification settings - Fork 0
Version Control
Gary edited this page Mar 30, 2015
·
1 revision
Initiate git flow in your local project first
master:
- 準備要 deploy 的版本
- Merge 的來源是 develop
- 上 production 前要檢查本次有改動的版本
develop:
- 大家都要基於這個 branch 開發,記得在開新 branch 時先 pull 更新一下 code
- 當要 merge 到此 branch 上時,希望能不要有出現任何 bugs
- 儘量不要再此 branch 有任何的更動,即使有小更動也麻煩一點使用
feature,降低上 production 時出錯的機率
feature:
- 新增/更新 code 時,都使用 feature
hotfix:
- 當有遇到非常嚴重的 bug ,而目前於
feature上開發的 code 都還無法 merge 回develop時使用 -
!!注意!! 當此 branch 結束後將會直接對
master,develop做強制 merge 的動作
release:
- 功能與
master類似,但會加上一個 release tag 來記錄一個版本 - 目前尚未有非常實用的功能,但未來如果有 release manager,應該要把
releasebranch 從master換成release
support:
- 暫時不使用
$ git flow feature start <branch name>
- 當要開發的時候,就用這個方法
- branch name 儘量以
WYSIWYG(What you see is what you get)的方式命名 - 開新的
featurebranch 前記得,先更新developbranch
$ git flow feature publish <branch name>
!!!使用前請先對
develop做 rebase!!!
- 將目前開發的進度發佈到遠端
- 不會把目前的 code merge 至
develop - 可以把 code 給別人 code review
- 當 publish 過後想要繼續新增 code,只要再用 push 就可以把 code 新增上去
$ git flow feature track <branch name>
- 將別人 publish 到遠端的 code track 到 local 端
$ git flow feature finish <branch name>
!!!使用前請先對
develop做 rebase!!!
- 將目前的 code merge 到 develop
- 當 track 完別人 publish 的 code,並且 finish 該 branch 後,遠端還是會有該 finish 過後的 branch,此時可以利用以下指令直接刪除遠端的 branch
$ git push origin :feature/<branch name>
# 源自 $ git push origin :<branch name>
# 冒號爲刪除之意
- 當branch publish 完並且被別人 finish 時,可以利用以下指令也把 local 端的 branch 刪除
$ git branch -D feature/<branch name>
# 源自 $ git branch -D <branch name>
- local 端會保有一些對於 remote branch 的 remote 位置記錄,如果想要清理該記錄,可以使用以下指令
$ git remote prune origin
如果使用有使用oh-my-zsh,可以在~/.zshrc中找到下面這段,於plugins加入git-flow,這樣將可以使用tab的自動補全功能
Example:
...
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git git-flow)
...