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

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

 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

mouson(墨嗓)

March 23, 2019
Tweet

More Decks by mouson(墨嗓)

Other Decks in Technology

Transcript

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

    bug bisect Ref: https://git-scm.com/docs/git-bisect
  2. ? ? ? ? ? ? ? HEAD Some feature

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    ? ? ? HEAD BAD BAD BAD GOOD GOOD X
  17. 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
  18. Demo Auto: 1. git bisect start HEAD v2.0 2. git

    bisect run ./vendor/bin/phpunit https://goo.gl/xGJxta
  19. Local GIT Rerere Sample I have a World!!! feature master

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

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

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

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

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

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

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

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

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

    a Apple !!! feature I have a Apple Pen !!! 1. Rebase 2. Merge master