Git with Github 開發流程 - oracle-design/guides GitHub Wiki
在版本控制下設計程式的指南。
- 盡量不要把只能在自己的工作電腦上運作的檔案放入版本控制。
- 在進行合併之後,請刪除本地與遠端的 feature branches。
- 建議在 feature branch 中進行開發。
- 記得常常 rebase upstream,保持版本和 upstream 一致。
- 用 pull request 來進行 code review。
使用 github 的 fork 功能將專案複製到自己的帳號下,並透過 git clone 複製到本地端開發。
git clone [email protected]:<YourName>/<RepoName>.git
建立新的遠端 repo 命名為 upstream,指向公司原址專案位址。
git remote add upstream [email protected]:oracle-design/<RepoName>.git
在本地端,從 master 開起一個新的 feature branch。
git checkout master
git pull
git checkout -b <branch-name>
在 branch-name 前加上你的識別作為前綴,例如 FunnyQ-user_mention
。
常常透過 rebase 來合併 upstream 的變動。
git fetch upstream
git rebase upstream/master
解掉所有 conflicts。當功能完成並通過測試,將檔案加入 stage。
git add --all
然後提交。
git status
git commit
提交 message 必須清楚明瞭,格式範例如下:
[Tag] writting commit message summary under 50 characters.
* more infomation about this commit
* more infomation about this commit
* …
refs #<ticket-number>
(關於 Tag 與 summary 可參考這裡。)
將這個 branch push 到自己的 repo。
git push origin <branch-name>
開啟一個 GitHub pull request
到 Hipchat 通知相關人員 code review。
團隊成員應該對 Pull request 進行 code review。並且注意自己的溝通是否合於規範,應盡力保持團隊氣氛良好、維持生產力,進行有效的溝通。
可以透過 Github 的功能直接在特定的程式碼上進行留言與討論,或是在 Slack Channel 上團隊即時討論。
當大家都覺得沒有問題,可以在 pull request 上留言表示已經可以 merge,然後正式 merge pull request。