Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Git Flow and JavaScript Coding Style

4,456 views

Published on

* Git Rebase vs Git Merge
* JavaScript Coding Style

Published in: Technology

Git Flow and JavaScript Coding Style

  1. 1. Git Flow and Coding Style Bo-Yi Wu 2015/04/10
  2. 2. Agenda • Git merge vs Git rebase. • JavaScript Coding Style.
  3. 3. Git merge vs Git rebase
  4. 4. Git merge • Create your branch – $ git checkout –b ‘response’ • Merge from develop branch – $ git merge develop
  5. 5. git merge develop
  6. 6. New commit Merge branch 'develop' into response (HEAD, response)
  7. 7. git merge develop again
  8. 8. New commit Merge branch 'develop' into response (HEAD, response)
  9. 9. git checkout develop git merge --no-ff response
  10. 10. Git rebase • Create your branch – $ git checkout –b ‘response’ • Merge from master branch – $ git rebase develop
  11. 11. Git rebase master
  12. 12. No more new commit log
  13. 13. Git rebase master again
  14. 14. No more new commit log
  15. 15. Create your new Pull Request git merge --no-ff respnse
  16. 16. git rebase vs git merge network graph
  17. 17. Rebase vs Merge 優缺點 rebase merge 避免過多 merge commit log 產生 merge commit log Branch commit log 排到最前面(方便追蹤) 依照時間排序 commit log network graph 清楚 network graph 不易理解 各別 commit 解決 conflict 一次將全部衝突顯示 可任意修改 commit log 可合併多個 commit (避免過多無意義 commit log)
  18. 18. Rebase vs Merge 使用時機 rebase merge 整理 Branch commit log 主分支記錄合併 xxxx branch 非主分支開發無需記錄何時合併主分支 主分支請勿使用 rebase 合併任何分支
  19. 19. Develop Note Please rebase master branch and test again before creating new Pull Request
  20. 20. JavaScript Coding Style Guide
  21. 21. 原先架構 https://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
  22. 22. Google JavaScript Style Guide 無任何範例可參考
  23. 23. Airbnb JavaScript Style Guide https://github.com/airbnb/javascript
  24. 24. Airbnb JavaScript Style Guide 程式碼範例完整 另外也可以參考 ES6 Branch
  25. 25. Yoda Conditions https://en.wikipedia.org/wiki/Yoda_conditions if ($a === ‘1’) { // code block } if (‘1’ === $a) { // code block } 程式閱讀性高 程式閱讀性低
  26. 26. Yoda Conditions https://en.wikipedia.org/wiki/Yoda_conditions if ($a = ‘1’) { // code block } 避免此種情況發生
  27. 27. How to prevent the condition? Write Unit Test
  28. 28. Thanks

×