Upgrade to Pro — share decks privately, control downloads, hide ads and more …

20190323_ThreeGitTips-台日技術社群交流會

Ab628671841774343b1020f22f712069?s=47 mouson
March 23, 2019

 20190323_ThreeGitTips-台日技術社群交流會

在台日技術社群交流會所做的分享,這份簡報主要介紹三個 GIT 的指令,分別是 bisect、rerere 以及 worktree:

* bisect 指令,我們可以比較快的找到發生錯誤的 commit
* rerere 指令,可以自動重複上一次的解決衝突的動作
* worktree 在相同的 repo 中,快速建立或取得 branch 在不一樣的工作資料夾中進行檔案修改

bisect 使用的 git repo: https://github.com/mouson/20170110-demo-bisect
rerere, worktree 使用的範例 git repo: https://github.com/mouson/git-rerere-worktree-demo

Ab628671841774343b1020f22f712069?s=128

mouson

March 23, 2019
Tweet

Transcript

  1. 陳佑⽵竹 Mouson <mouson@gmail.com> 2019.03.23 台⽇日技術交流聚會@ 天瓏書局 Three Tips

  2. About Me • 陳佑⽵竹,朋友都叫我墨墨嗓 (Mouson)。專注於資訊科技整 合、應⽤用、開發⽅方法及研究的T 型⼈人,現任 PHP 資訊系統分析 師/⼈人夫/⼀一隻臘腸狗的爸爸/通⽤用

    設計(ユニヴァーサルデザイン) 推廣。平時喜好⽻羽球、登⼭山及 ⼿手沖咖啡。 • mouson@gmail.com • https://fb.me/mouson
  3. Three Tips

  4. Three Tips bisect

  5. Three Tips rerere bisect

  6. Three Tips rerere worktree bisect

  7. Use binary search to find the commit that introduced a

    bug bisect Ref: https://git-scm.com/docs/git-bisect
  8. v2.3

  9. ? ? ? ? ? ? ? HEAD Some feature

    was a failure after merge v2.3
  10. ? ? ? ? ? ? ? HEAD Some feature

    was a failure after merge v2.3 git bisect start HEAD v2.3
  11. Use git bisect search failure commit v2.3 ? ? ?

    ? ? ? ? HEAD git bisect start HEAD v2.3
  12. Use git bisect search failure commit v2.3 ? ? ?

    ? ? ? ? HEAD git bisect start HEAD v2.3
  13. Use git bisect search failure commit v2.3 ? ? ?

    ? ? ? ? HEAD BAD git bisect start HEAD v2.3
  14. Use git bisect search failure commit v2.3 ? ? ?

    ? ? ? ? HEAD BAD
  15. Use git bisect search failure commit v2.3 ? ? ?

    ? ? ? ? HEAD BAD git bisect bad
  16. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD git bisect bad
  17. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD git bisect bad
  18. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD
  19. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD
  20. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD
  21. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD git bisect good
  22. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD git bisect good
  23. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD GOOD git bisect good
  24. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD GOOD
  25. Use git bisect search failure commit v2.3 ? ? ?

    BAD ? ? ? HEAD BAD BAD BAD GOOD GOOD X
  26. use git blame find detail v2.3 ? ? ? BAD

    ? ? ? HEAD BAD BAD BAD GOOD GOOD X
  27. Demo https://goo.gl/xGJxta UnitTest can be successfully executed in v2.0, but

    failed in the current version.
  28. Demo Manuel: 1. git bisect start HEAD v2.0 2. phpunit

    / git bisect bad 3. phpunit / git bisect good 4. phpunit / git bisect good 5. git bisect reset https://goo.gl/xGJxta
  29. Demo Auto: 1. git bisect start HEAD v2.0 2. git

    bisect run ./vendor/bin/phpunit https://goo.gl/xGJxta
  30. Reuse recorded resolution of conflicted merges rerere https://git-scm.com/docs/git-rerere

  31. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  32. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!! I have a Apple Pen !!!
  33. GIT Rerere Demo 1. enable rerere feature git config --global

    rerere.enabled true https://goo.gl/8wj1he
  34. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  35. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  36. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  37. Local GIT Rerere Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  38. Manage multiple working trees worktree https://git-scm.com/docs/git-worktree

  39. Local GIT worktree Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  40. Local GIT worktree Sample I have a World!!! feature master

    I have a Apple !!! I have a Pen !!!
  41. Local GIT worktree Sample I have a World!!! I have

    a Apple !!! master I have a Pen !!! feature 1. Rebase
  42. Local GIT worktree Sample I have a World!!! I have

    a Apple !!! master feature I have a Apple Pen !!! 1. Rebase
  43. Local GIT worktree Sample I have a World!!! I have

    a Apple !!! feature I have a Apple Pen !!! 1. Rebase 2. Merge master
  44. Three Tips rerere worktree bisect

  45. Q & A 陳佑⽵竹 Mouson <mouson@gmail.com> https://facebook.com/mouson