Comparison of general workflow (https://github.com/geeeeeeeeek/git-recipes/wiki/3.5-常见工作流比较)
1) Create branch
2) Add commits
commit message撰寫官方建議:
用一句話總結本次commit的主旨
如需要進一步說明,請在三句話以內結束本段,可利用「因為發現了什麼問題所以用了什麼方法解決」的問答格式。
修正了哪些地方:
- 使用者回報的bug 已用某方法解決
- 內部測試的bug 已用某某方法解決
Short (50 chars or less) summary of changes.
More detailed explanatory text, if necessary. Wrap it to about 72 characters or so.
Further paragraphs come after blank lines.
- Bug from user report, fix it with some way.
- Bug from alpha test, fix it with another solution.
3) Pull Request
分成兩種模式:
4) Discuss and review your code
PR的好處就在於code reviewer之間可以彼此交流,有時候一閃神忘了做某些修正或是提交的code有bug等等小事,都可以利用comments提醒project mantainer。
另外PR的comments是使用markdown語法,所以你可以嵌入圖片(image)、顏文字(emoji)、自動上色的程式區塊和其他的語法。
5) Merge and Deploy
當PR已經被完整review過而且該branch也通過測試,就可以merge回master branch上準備發佈了。
小技巧:如果在issues中有這次merge能解決的問題,可以在commit message中輸入「This fixes #32, resolve #67, and closes user/repo#11」,就會將issues #32、#67和位在user/repo中的issue #11都close掉。
Ref: Git Protocol
有效利用git brach特性的開發模型!
主要分成下列branch:
Ref: git-flow cheatsheet
# 初始化git flow braching model
git flow init
# 開新feature
git flow feature start FEATURE_NAME
# 結束feature
git flow feature finish FEATURE_NAME
# [協作] 發佈feature
git flow feature publish FEATURE_NAME
# [協作] 取得feature
git flow feature pull FEATURE_NAME
# 釋出階段 開版號
git flow release start VERSION_NAME
# [協作] 允許其他開發者提交 commit
git flow release publish VERSION_NAME
# 正式釋出
git flow release finish VERSION_NAME
# push tag to remote
git push --tags
# 重大修正 開版號
git flow hotfix start VERSION_NAME
# 打上patch後再次釋出
git flow hotfix finish VERSION_NAME
OS: 幹 我還是用UI好了啦 >>Sourcetree