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

こわくないプルリク

 こわくないプルリク

Github の Pull Request にフォーカスした Overview.
kanazawa.rb meetup 10 発表資料。

Cb057b585817007ba2a931a81ef9398f?s=128

Tomokazu Kiyohara

June 15, 2013
Tweet

Transcript

  1. ͜Θ͘ͳ͍ϓϧϦΫ Pull Request is not afraid LBOB[BXBSC

  2. Github http://github.com

  3. Pull Request

  4. Pull Request

  5. ͳʹ͢Δ΋ͷʁ ࣗ෼ͷίʔυΛ औΓࠐΜͰ΋Β͏खଓ͖

  6. ͜Θ͍ͷʁ ໎࿭Λ͔͚Δ Մೳੑ͕͋ΔͷͰ ͪΐͬͱͼͼΔ

  7. ͜Θ͍ͷʁ ͜Θ͘͸ͳ͍ ʢ໎࿭ͷத਎Λ஌Ε͹ʣ

  8. Let's Start

  9. ϧʔϧ • ෼ذݩ͕ಉ͡ϒϥϯνͲ͏͠Ͱ࢖͑Δ • Ҏ্

  10. Fork ͸ʁ Fork ͸ඞਢͰ͸ͳ͍ Ή͠ΖҰਓͰ΋Ͱ͖Δ

  11. master work A A B 1. checkout -b work 2.

    commit
  12. A A B Ϛʔδͯ͠ master work 1. checkout -b work

    2. commit
  13. A A B ͍͍Α B 3. merge master work 1.

    checkout -b work 2. commit
  14. Shared Repository Model • ڞ༻ϦϙδτϦͰར༻ • Collaborators • Organizations

  15. A B B A B 4. push A 1. clone

    5. merge master work 2. checkout -b work 3. commit
  16. Fork & Pull Model • User ؒͰར༻

  17. A B A 1. fork B A B A 6.

    pull master work master 5. push 2. clone 3. checkout -b work 4. commit
  18. Send Pull Request

  19. Send Pull Request

  20. Send Pull Request

  21. Send Pull Request

  22. Receive Pull Request

  23. Receive Pull Request

  24. Merge Pull Request

  25. Merge Pull Request

  26. ·ͬͨ͘؆୯ͩ

  27. ໎࿭ύλʔϯ

  28. ໎࿭ύλʔϯ • Pull Request ޙͷίϛοτ • ίϯϑϦΫτ • େྔͷίϛοτ

  29. Pull Request ޙͷίϛοτ • Pull Request ͷର৅͸ϒϥϯν • Ϋϩʔζલʹ௥Ճίϛοτ͢Δͱ •

    Pull Request ͷର৅ʹؚ·Εͯ͠·͏ • Pull Request ઌʹ Notification ͕ඈͿ • ίʔυϨϏϡʔˍमਖ਼൓өͷ༻్ʹରԠ͢ΔͨΊ
  30. A B A B 4. push A 1. clone master

    work 2. checkout -b work 3. commit
  31. A B A B 4. push A 1. clone master

    work 2. checkout -b work 3. commit C C D D 5. commit 7. commit 6. push 8. push
  32. Pull Request ޙͷίϛοτ • ίʔυϨϏϡʔ໨త • ·ͬͨ͘໰୊ͳ͍ར༻๏ • ผػೳͷ։ൃ໨త •

    ໰୊ͷ͋Δʢ໎࿭ͳʣར༻๏ • ผϒϥϯνͰ࡞ۀΛ͢Δ͜ͱͰղܾ
  33. ίϯϑϦΫτ • ݩιʔεͷมߋʹ௥ै͍ͯ͠ͳ͍ͱൃੜ͢Δ • ͜·Ίͳ pull & rebase Ͱղܾ

  34. A B X A B 4. push A 1. clone

    5. merge master work 2. checkout -b work 3. commit commit
  35. B master A B' X A 6. push 1. clone

    7. merge master work 2. checkout -b work 3. commit B' B' X 4. pull A commit X 5. rebase
  36. A X A 1. fork B A B A 6.

    pull master work master 5. push 2. clone 3. checkout -b work 4. commit commit
  37. B 5. rebase master A X A 1. fork B'

    A X A 8. pull master work master 7. push 2. clone 3. checkout -b work 4. commit commit B' X 5. pull B'
  38. B 5. rebase master A X A 1. fork B'

    A X A 8. pull master work master 7. push 2. clone 3. checkout -b work 4. commit commit B' X 5. pull B'
  39. Tips : Fork ݩ͔Β pull 1. git remote add upstream

    https://github.com/<org>/<rep>.git 2. git checkout master 3. git pull upstream master
  40. B 5. rebase master A X A 1. fork B'

    A X A 8. pull master work master 7. push 2. clone 3. checkout -b work 4. commit commit B' X 5. pull B'
  41. Tips : rebase ? merge ? • merge Ͱ͸ͳ͘ rebase

    • ޙड़ͷίϛοτͷू໿Λ࣮ݱ͢ΔͨΊ • rebase લʹϒϥϯνΛ push ͍ͯͨ͠৔߹ • rebase ޙʹ push ͢Δࡍ͸ -f Φϓγϣϯ͕ඞཁ • rebase ͷޭࡑ΋͋Γ merge ೿΋͍Δ • ίϛοτͷू໿͸͠ͳ͍ӡ༻
  42. େྔͷίϛοτ • ίϛοτ਺͕େྔʹ͋Δ Pull Request • ίʔσΟϯά࡞ۀ࣌ʹࡉ͔ʹίϛοτ͍ͯ͠Ε͹ Α͋͘Δঢ়گ

  43. A P A B 4. push A 1. clone 5.

    merge master work 2. checkout -b work 3. commiiiiiiiiiiits B B B B B B B B B B B B B B P B B B B B B B B B B B B B B B P P P P P P P P P P P P P P P
  44. େྔͷίϛοτ • Pull Request ઌͰͷίϛοτϩάංେԽ • ࠩ෼Λ֬ೝ͢Δͷ͕ࠔ೉ʹͳΔ • rebase -i

    Ͱ1ίϛοτʹ·ͱΊΔ͜ͱͰղܾ 1. git checkout work 2. git rebase -i master 3. pick, squash, squash, squash...
  45. A A 5. push A 1. clone 6. merge master

    work 3. commiiiiiiiiiiits B P' P' P P' 2. checkout -b work 4. rebase -i (squash)
  46. Tips : Pull Request Branch • ࡞ۀ༻ϒϥϯνͷཤྺΛ࢒͍ͨ͠৔߹ • Pull Request

    ઐ༻ϒϥϯνΛ࡞੒͢Δ 1. git checkout work 2. git checkout -b pr-work 3. git rebase -i master 4. pick, squash, squash, squash...
  47. Conclusion • Pull Request ͸ා͘ͳ͍ • ػೳຖͷϒϥϯνϯά • ͜·Ίͳ pull

    & rebase • ίϛοτͷू໿ʢrebase -iʣ
  48. Conclusion • Pull Request ͸ා͘ͳ͍ • ػೳຖͷϒϥϯνϯά • ͜·Ίͳ pull

    & rebase • ίϛοτͷू໿ʢrebase -iʣ "ઈର" ͷϧʔϧ͸ͳ͍ ʢͳʹ͕͓͜Δ͔೺Ѳͯ͠࢖͑͹Α͍ʣ
  49. ·ͣ͸ࣗ෼ͷϦϙδτϦͰ ϒϥϯν͑͞੾Ε͹͙͢ࢼͤΔʂ

  50. Thank you Tomokazu Kiyohara http://github.com/kiyohara http://facebook.com/tomokazu.kiyohara

  51. &YUSB • http://blog.qnyp.com/2013/05/28/pull-request-for-github-beginners/ • http://kik.xii.jp/archives/179 • http://d.hatena.ne.jp/hnw/20110528