Slide 1

Slide 1 text

git flow 加速提升⼯工作效率 & 品質 CJ 2016/09/22
 GSS

Slide 2

Slide 2 text

why git flow?

Slide 3

Slide 3 text

確保開發順暢...

Slide 4

Slide 4 text

多⼈人共同開發問題 • 各⾃自寫各的,不不知道怎麼整合? • 整合時不不⼩小⼼心覆蓋了了別⼈人的東⻄西... • 上傳有問題的 code 導致程式炸裂,⽽而⾃自⼰己不不知道... • 沒辦法確認哪個點是可以 work 的... • 最後⼤大家被搞得⼀一團亂...

Slide 5

Slide 5 text

pros of git flow • 更更加了了解專案整體、各個⽀支線的發展狀狀況 • 可各⾃自各開發⽀支線,不不會被其他⼈人影響 • 如果主線崩壞也可輕鬆 rollback • 分⼯工更更加輕鬆 開開⼼心⼼心下班去

Slide 6

Slide 6 text

what is git flow? 講這麼多... then

Slide 7

Slide 7 text

single branching master

Slide 8

Slide 8 text

develop hotfix release feature feature master v1.0 v1.1 v1.2 git flow introduced by Vincent Driessen

Slide 9

Slide 9 text

master & develop develop master • 永遠在 production-ready 狀狀態 • 開發⽤用主線,永遠是最新的狀狀態

Slide 10

Slide 10 text

feature branch • 從 develop 分⽀支出來來開發新功能 • 完成後合併回 develop • 可多個 features 並⾏行行 • ⽤用完即棄 feature 1 develop feature 2

Slide 11

Slide 11 text

release branch • develop 發佈到 master 的記錄錄 • 過程中只修 bugs • 完成後合併進 master & develop • ⽤用版號命名 release develop master

Slide 12

Slide 12 text

hotfix branch • 對 master 做緊急修正 • 過程中⼀一樣只修 bugs • 完成後合併進 master & develop • ⽤用完即棄 hotfix master develop

Slide 13

Slide 13 text

how to use git flow? 那...

Slide 14

Slide 14 text

⾸首先打開你的 terminal… $ git flow init

Slide 15

Slide 15 text

wtf!

Slide 16

Slide 16 text

SourceTree 其實有內奸內建 git flow 功能

Slide 17

Slide 17 text

可以從 toolbar 內開啟

Slide 18

Slide 18 text

Repository > Git flow / Hg flow

Slide 19

Slide 19 text

initialise

Slide 20

Slide 20 text

start a new branch

Slide 21

Slide 21 text

finish a branch

Slide 22

Slide 22 text

or merge

Slide 23

Slide 23 text

完成 release 或 hotfix branch 時, 會⾃自動幫你合併到 master & develop

Slide 24

Slide 24 text

a beautiful flow https://ihower.tw/blog/archives/5140

Slide 25

Slide 25 text

demo time

Slide 26

Slide 26 text

notices • merge 前記得要先 fetch or rebase,確保狀狀態是最新的 • 不不對主線直接 commit,必須另開⽀支援性 branch 再進⾏行行修改 • 必須 commit merge changes • 開 pull requests 做 code reviews

Slide 27

Slide 27 text

pull requests 除了了 git flow 外,還有⼀一個很重要的

Slide 28

Slide 28 text

pull requests merge requests

Slide 29

Slide 29 text

what is pull requests? feature develop 利利⽤用 pull requests 確認是否能進⾏行行 merge ?

Slide 30

Slide 30 text

• 描述做了了什什麼事情及⽬目的 • 可進⾏行行討論 & code reviews • 清楚知道哪個部分有被更更動 • 留留下記錄錄,⽅方便便之後重新翻閱 (merge requests in gitlab)

Slide 31

Slide 31 text

pull requests at iCHEF • 特定 template, 描述⽬目的&內容 • 必須進⾏行行 code reviews • 通過 CI 檢測 • 如有界⾯面更更動需提供截圖 • 不不能擺著超過⼀一週

Slide 32

Slide 32 text

獲得2個以上的『OK』才能通關 pull requests at iCHEF

Slide 33

Slide 33 text

github universe 2016 code better with reviews https://github.com/universe-2016

Slide 34

Slide 34 text

NEW approve & request changes

Slide 35

Slide 35 text

change base branch

Slide 36

Slide 36 text

references • http://nvie.com/posts/a-successful-git-branching-model • https://ihower.tw/blog/archives/5140 • https://yangsu.github.io/pull-request-tutorial • https://about.gitlab.com/2014/09/29/gitlab-flow

Slide 37

Slide 37 text

$ exit thanks for your listening