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

こわくないプルリク

 こわくないプルリク

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

Tomokazu Kiyohara

June 15, 2013
Tweet

More Decks by Tomokazu Kiyohara

Other Decks in Technology

Transcript

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

    View Slide

  2. Github
    http://github.com

    View Slide

  3. Pull Request

    View Slide

  4. Pull Request

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  8. Let's Start

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  14. Shared Repository Model
    • ڞ༻ϦϙδτϦͰར༻
    • Collaborators
    • Organizations

    View Slide

  15. A
    B
    B
    A B
    4. push
    A
    1. clone
    5. merge
    master
    work
    2. checkout -b work
    3. commit

    View Slide

  16. Fork & Pull Model
    • User ؒͰར༻

    View Slide

  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

    View Slide

  18. Send Pull Request

    View Slide

  19. Send Pull Request

    View Slide

  20. Send Pull Request

    View Slide

  21. Send Pull Request

    View Slide

  22. Receive Pull Request

    View Slide

  23. Receive Pull Request

    View Slide

  24. Merge Pull Request

    View Slide

  25. Merge Pull Request

    View Slide

  26. ·ͬͨ͘؆୯ͩ

    View Slide

  27. ໎࿭ύλʔϯ

    View Slide

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

    View Slide

  29. Pull Request ޙͷίϛοτ
    • Pull Request ͷର৅͸ϒϥϯν
    • Ϋϩʔζલʹ௥Ճίϛοτ͢Δͱ
    • Pull Request ͷର৅ʹؚ·Εͯ͠·͏
    • Pull Request ઌʹ Notification ͕ඈͿ
    • ίʔυϨϏϡʔˍमਖ਼൓өͷ༻్ʹରԠ͢ΔͨΊ

    View Slide

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

    View Slide

  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

    View Slide

  32. Pull Request ޙͷίϛοτ
    • ίʔυϨϏϡʔ໨త
    • ·ͬͨ͘໰୊ͳ͍ར༻๏
    • ผػೳͷ։ൃ໨త
    • ໰୊ͷ͋Δʢ໎࿭ͳʣར༻๏
    • ผϒϥϯνͰ࡞ۀΛ͢Δ͜ͱͰղܾ

    View Slide

  33. ίϯϑϦΫτ
    • ݩιʔεͷมߋʹ௥ै͍ͯ͠ͳ͍ͱൃੜ͢Δ
    • ͜·Ίͳ pull & rebase Ͱղܾ

    View Slide

  34. A
    B
    X
    A B
    4. push
    A
    1. clone
    5. merge
    master
    work
    2. checkout -b work
    3. commit
    commit

    View Slide

  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

    View Slide

  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

    View Slide

  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'

    View Slide

  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'

    View Slide

  39. Tips : Fork ݩ͔Β pull
    1. git remote add upstream https://github.com//.git
    2. git checkout master
    3. git pull upstream master

    View Slide

  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'

    View Slide

  41. Tips : rebase ? merge ?
    • merge Ͱ͸ͳ͘ rebase
    • ޙड़ͷίϛοτͷू໿Λ࣮ݱ͢ΔͨΊ
    • rebase લʹϒϥϯνΛ push ͍ͯͨ͠৔߹
    • rebase ޙʹ push ͢Δࡍ͸ -f Φϓγϣϯ͕ඞཁ
    • rebase ͷޭࡑ΋͋Γ merge ೿΋͍Δ
    • ίϛοτͷू໿͸͠ͳ͍ӡ༻

    View Slide

  42. େྔͷίϛοτ
    • ίϛοτ਺͕େྔʹ͋Δ Pull Request
    • ίʔσΟϯά࡞ۀ࣌ʹࡉ͔ʹίϛοτ͍ͯ͠Ε͹
    Α͋͘Δঢ়گ

    View Slide

  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

    View Slide

  44. େྔͷίϛοτ
    • Pull Request ઌͰͷίϛοτϩάංେԽ
    • ࠩ෼Λ֬ೝ͢Δͷ͕ࠔ೉ʹͳΔ
    • rebase -i Ͱ1ίϛοτʹ·ͱΊΔ͜ͱͰղܾ
    1. git checkout work
    2. git rebase -i master
    3. pick, squash, squash, squash...

    View Slide

  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)

    View Slide

  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...

    View Slide

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

    View Slide

  48. Conclusion
    • Pull Request ͸ා͘ͳ͍
    • ػೳຖͷϒϥϯνϯά
    • ͜·Ίͳ pull & rebase
    • ίϛοτͷू໿ʢrebase -iʣ
    "ઈର" ͷϧʔϧ͸ͳ͍
    ʢͳʹ͕͓͜Δ͔೺Ѳͯ͠࢖͑͹Α͍ʣ

    View Slide

  49. ·ͣ͸ࣗ෼ͷϦϙδτϦͰ
    ϒϥϯν͑͞੾Ε͹͙͢ࢼͤΔʂ

    View Slide

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

    View Slide

  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

    View Slide