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. A A B ͍͍Α B 3. merge master work 1.

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

    5. merge master work 2. checkout -b work 3. commit
  3. A B A 1. fork B A B A 6.

    pull master work master 5. push 2. clone 3. checkout -b work 4. commit
  4. Pull Request ޙͷίϛοτ • Pull Request ͷର৅͸ϒϥϯν • Ϋϩʔζલʹ௥Ճίϛοτ͢Δͱ •

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

    work 2. checkout -b work 3. commit
  6. 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
  7. Pull Request ޙͷίϛοτ • ίʔυϨϏϡʔ໨త • ·ͬͨ͘໰୊ͳ͍ར༻๏ • ผػೳͷ։ൃ໨త •

    ໰୊ͷ͋Δʢ໎࿭ͳʣར༻๏ • ผϒϥϯνͰ࡞ۀΛ͢Δ͜ͱͰղܾ
  8. A B X A B 4. push A 1. clone

    5. merge master work 2. checkout -b work 3. commit commit
  9. 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
  10. 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
  11. 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'
  12. 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'
  13. Tips : Fork ݩ͔Β pull 1. git remote add upstream

    https://github.com/<org>/<rep>.git 2. git checkout master 3. git pull upstream master
  14. 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'
  15. Tips : rebase ? merge ? • merge Ͱ͸ͳ͘ rebase

    • ޙड़ͷίϛοτͷू໿Λ࣮ݱ͢ΔͨΊ • rebase લʹϒϥϯνΛ push ͍ͯͨ͠৔߹ • rebase ޙʹ push ͢Δࡍ͸ -f Φϓγϣϯ͕ඞཁ • rebase ͷޭࡑ΋͋Γ merge ೿΋͍Δ • ίϛοτͷू໿͸͠ͳ͍ӡ༻
  16. 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
  17. େྔͷίϛοτ • Pull Request ઌͰͷίϛοτϩάංେԽ • ࠩ෼Λ֬ೝ͢Δͷ͕ࠔ೉ʹͳΔ • rebase -i

    Ͱ1ίϛοτʹ·ͱΊΔ͜ͱͰղܾ 1. git checkout work 2. git rebase -i master 3. pick, squash, squash, squash...
  18. 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)
  19. 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...
  20. Conclusion • Pull Request ͸ා͘ͳ͍ • ػೳຖͷϒϥϯνϯά • ͜·Ίͳ pull

    & rebase • ίϛοτͷू໿ʢrebase -iʣ "ઈର" ͷϧʔϧ͸ͳ͍ ʢͳʹ͕͓͜Δ͔೺Ѳͯ͠࢖͑͹Α͍ʣ