Developing with Git and Pull Request / Git x Pull Request でチーム開発

Developing with Git and Pull Request / Git x Pull Request でチーム開発

PHPカンファレンス2012 発表資料 / PHP Conference Tokyo 2012

4564d3601f6230782300dff8499b2d5a?s=128

Sotaro Karasawa

September 15, 2012
Tweet

Transcript

  1. Crocos, Inc. Sotaro Karasawa @sotarok http://facebook.com/sotarok PHP Conference Tokyo 2012

    / Sep 15, 2012 Git x Pull Request νʔϜ։ൃ࠷ऴԞٛ
  2. Git

  3. CTO @ Crocos, Inc. Ethna git-daily ύʔϑΣΫτPHP ࣗݾ঺հ Sotaro Karasawa

    / @sotarok ฑ୔૱ଠ࿠ 1985/09/15 ੜ·Ε
  4. None
  5. Crocos, Inc (Ϋϩίε) FacebookΛத৺ʹιʔγϟϧάϥϑΛར༻͠ ͨΞϓϦέʔγϣϯ։ൃ ઃཱ 2011/2 2012/8 ~ Yahoo!

    JAPAN http://crocos.co.jp/ http://www.facebook.com/Crocos.Inc
  6. Git Λ࢖ͬͨ։ൃ

  7. Git Ҡߦ ʹ͍ͭͯߟ͑Δ

  8. svn up git pull

  9. svn ci git push

  10. Ͱ͸ͳ͍ʂ

  11. Gitʹ Ҡߦ͢Δ ͱ͸

  12. Git ʹҠߦ͢Δͱ͸ɺ ͋Δ͍͸ Git Λ࢖ͬͯ։ൃΛ͢Δ͜ͱ͸ svn ʹରԠ͢ΔίϚϯυΛ֮͑Δ͜ͱͰ ͸ͳ͘ɺ Git Λ࠷େݶ׆༻Ͱ͖Δ։ൃϑϩʔΛߟ

    ͑ɺνʔϜ։ൃʹద༻͢Δ͜ͱͰ͋Δ
  13. Git Λ࠷େݶ׆༻Ͱ͖Δ։ൃϑϩʔͱ͸ʁ

  14. ɾϩʔΧϧͰؾܰʹίϛοτ ɾϩʔΧϧͰؾܰʹϒϥϯνΛ੾Δ ɾݡ͘ɺߴ଎ͳϚʔδ Git Λ࠷େݶ׆༻Ͱ͖Δ։ൃϑϩʔͱ͸ʁ

  15. ɾϩʔΧϧͰؾܰʹίϛοτ ɾϩʔΧϧͰؾܰʹϒϥϯνΛ੾Δ ɾݡ͘ɺߴ଎ͳϚʔδ Git Λ࠷େݶ׆༻Ͱ͖Δ։ൃϑϩʔͱ͸ʁ ͜ΕΛੜ͔ͨ͠ϒϥϯνઓུ

  16. Git ͷϒϥϯνઓུ

  17. ͲͷΑ͏ʹϒϥϯνΛ੾Γɺ ɾ೔ʑͷ։ൃ ɾϦϦʔε ɾۓٸରԠ ͳͲΛ͜ͳ͔͢ ϒϥϯνઓུͬͯʁ

  18. Git ϒϥϯνઓུͷ ϕετϓϥΫςΟεͷͻͱͭ A Successful Git Branching Model http://nvie.com/posts/a-successful-git-branching- model/

    ೔ຊޠ༁ http://keijinsonyaban.blogspot.jp/2010/10/ successful-git-branching-model.html
  19. None
  20. master develop release feature hotfix

  21. master ৗʹɺ࠷৽ͷ҆ఆͨ͠ ιʔείʔυ͕खʹೖΔ (ϦϦʔε͞Εͨίʔυ)

  22. develop ೔ʑͷ։ൃΛߦ͏ merge

  23. release ϦϦʔεલͷ ֬ೝΛߦ͏ ඞཁ͕͋Ε͹ मਖ਼͢Δ release/1.0.2 ྫ:

  24. release ϦϦʔεલ࠷ऴ֬ೝ

  25. release ෆ۩߹ൃݟ मਖ਼ίϛοτ

  26. release ϦϦʔεϓϩηεʹೖͬ ͯ΋ɺ։ൃΛܧଓͰ͖Δ

  27. release मਖ਼׬ྃɺ׬੒͠ ͨιʔεΛ masterʹmerge

  28. release मਖ਼ͨ݁͠ՌΛ developʹ΋൓ө

  29. feature ෳ਺ͷҟͳΔ ػೳΛฏߦͯ͠ ։ൃΛਐΊΔ

  30. feature ׬੒ͨ͠Β developʹmerge feature/hoge

  31. feature ಉ࣌ʹ͍ͭ͘Ͱ΋ฏ ߦͯ͠࡞ۀͰ͖Δ feature/hoge feature/fuga

  32. hotfix develop ͷ ׬੒Λ଴ͨͣʹ master ͷ मਖ਼͕͍ͨ͠ʂ

  33. hotfix

  34. hotfix master͔Β ௚઀ϒϥϯνΛ੾ͬ ͯमਖ਼

  35. hotfix मਖ਼͕ऴΘͬͨΒ masterʹϚʔδ͠ ͯϦϦʔε

  36. hotfix ౰વมߋ಺༰͸ developʹ΋൓ө

  37. None
  38. Git ͷͨΊʹɺΑ͘ߟ͑ΒΕͨ ϒϥϯνӡ༻Ϟσϧ ༷ʑͳӡ༻ํ๏ʹɺॊೈʹରԠՄೳ A Successful Git Branching Model

  39. gitflow nvieࢯۘ੡ɻ git-daily ੿࡞ɻ WebαʔϏε։ൃ޲͚ʹΞϨϯδ A Successful Git Branching Model

    Λ࣮ݱ͢Δπʔϧ
  40. ͚ͩͲ... ඞͣ͜ͷ௨Γ΍Βͳ͚Ε͹͍͚ͳ͍͜ͱ ͸ͳ͍ ͜ΕΛࢀߟʹɺࣗ෼ͷνʔϜͰͷӡ༻ϑ ϩʔʹ߹͏Α͏ʹΞϨϯδ A Successful Git Branching Model

    ϒϥϯνӡ༻ϞσϧͷϕετϓϥΫςΟε
  41. ɾසൟʹϦϦʔε͞ΕΔWebαʔϏε ɾ͍͍ͪͪόʔδϣϯ൪߸͚ͭͳ͍ ɾ͍͍ͪͪλάΛ͚ͭͳ͍ ɾ೔෇ͰϦϦʔεϒϥϯν ɾϦϞʔτ࿈ܞ(νʔϜӡ༻)Λߟྀ ɾPHP੡ $ pear install openpear/git_daily

    git-daily ΞϨϯδ ... ͨͱ͑͹
  42. Pull Request Λ࢖ͬͨ։ൃϑϩʔ

  43. Pull Request ͱ͸ ɾGitHub ͱ͔ʹ͋Δ΍ͭ A ͕ॻ͍ͨίʔυʹରͯ͠ ... Bʮ͜Μͳػೳ͕ཉ͍͔͠Β͜ΜͳมߋΛ ॻ͍ͯΈͨΑɻͱΓ͜ΜͰʂʯ

    AʮOKɺpull ͠·͢ʯ Έ͍ͨͳ΍ͭ
  44. Pull Request ͷԿ͕ྑ͍͔ ʮPull Requestʯ ͸Φʔϓϯιʔεʹݶ Βͣ࢖͑Δ༏Εͨ։ൃϑϩʔͩ http://d.hatena.ne.jp/sotarok/20120219/1329581585 खલຯḩͰ͕͢ɺ ੋඇಡΜͰ͍ͩ͘͞ʂ

  45. ίʔυͷมߋ ෳ਺ਓͰ։ൃ͢Δ΋ͷͰ͋Ε͹ɺ ʮଞਓ͕ॻ͍ͨίʔυʯ Λมߋ͠ͳ͚Ε͹͍͚ͳ͍λΠϛϯά͕ ඞͣ͋Δ

  46. (1) ґཔλΠϓ

  47. (2) ׬શ෼཭૿৩λΠϓ

  48. (3) উखʹมߋλΠϓ

  49. (4) Pull Request λΠϓ

  50. ϒϥϯνઓུʹ Pull Request Λ ૊ΈࠐΉ

  51. feature/hoge feature/fuga

  52. feature/hoge feature/fuga mergeલʹ pull request ϨϏϡʔ mergeલʹ pullrequest ͰϨϏϡʔ

  53. ࡉ෼Խ͞Εͨ ɹɹίʔυϨϏϡʔ

  54. ௒ޮՌత

  55. Pull Request Ϛʔδ࣌ͷ ϨϏϡʔ͸ͳͥޮՌత͔ ɾมߋͷίϯςΩετ͕໌֬ ౰વɺਖ਼͘͠ feature ϒϥϯν͕ӡ༻͞Ε͍ͯΔ͜ ͱ͸લఏͱͳΔɻܒ໤׆ಈ͸ඞཁɻ ɾখ͞ͳpatch

    ϨϏϡʔ͢Δର৅ͷίʔυ͸খ͚͞Ε͹খ͍͞΄ ͲɺϨϏϡʔίετ͸Լ͕Δ
  56. Pull Request ͷԿ͕ྑ͍͔ (·ͱΊ) ɾύονͷ΍ΓͱΓ͕ՄࢹԽ͞ΕɺΦʔ ϓϯͰɺه࿥࢒Δ ɾ ֘౰ͷίʔυͷ੹೚Λ࣋ͭਓ͕͍Δ ɾมߋ͞ΕΔίʔυΛݩʹٞ࿦͕Ͱ͖Δ ɾখ͞ͳpatchͰ࣭ͷߴ͍ϨϏϡʔ

    ɾϦϑΝΫλ
  57. Pull Request Λఏڙ͢ΔγεςϜ ɾGitHub (༗ྉͰprivateϦϙδτϦ) ඇਪ঑ɻprivate ϦϙδτϦɺEnterprise ΑΓ͍҆ ͚Ͳ ...

    མͪͯΔͱϦϦʔεͰ͖ͳ͍ΑͶ ɾGitHub Enterprise ͓͕ۚ͋ΔͳΒΦεεϝɻ ɾGitLab ແྉɻϝϯς͸େมɻMerge Requestɻଟগόάͬ ͯ΋ෆຬΛݴΘͳ͍ খن໛ͳνʔϜͳΒΦεεϝɻ
  58. Pull Request Λఏڙ͢ΔγεςϜ GHE GitLab Ձ֨ $21/user/݄ ແྉ ϝϯςφϯείετ ௿͍

    (ແ Ͱ͸ͳ͍) ߴ͍ Repository Viewer ˕ ˕ Network Chart ˕ ˕ User Namespace / Fork ˕ × Pull Request ˕ ˕ Auto Merge (Web͔Β) ˕ ˕
  59. Pull Request Λఏڙ͢ΔγεςϜ GHE GitLab Ձ֨ $21/user/݄ ແྉ ϝϯςφϯείετ ௿͍

    (ແ Ͱ͸ͳ͍) ߴ͍ Repository Viewer ˕ ˕ Network Chart ˕ ˕ User Namespace / Fork ˕ × Pull Request ˕ ˕ Auto Merge (Web͔Β) ˕ ˕ EJGGϏϡʔ มߋϑΝΠϧϦετɾEJGGϏϡʔ ίϝϯτ ߦίϝϯτ 8FCΠϯλʔϑΣΠε͔ΒͷࣗಈϚʔδ ϚʔδޙࣗಈΫϩʔζ
  60. GitLab

  61. ΫϩίεͰͷࣄྫ

  62. GitLab ಋೖ & Pull Request ඞਢʹ ɾجຊతʹ feature ϒϥϯνΛͭ͘Δ ʢ͜Ε͸ͦΕҎલ͔ΒͰ͖͍ͯͨʣ

    ɾ2ਓ1૊ (1ਓͱϦʔμʔͱܾΊΔ) ͰνʔϜΛ࡞Γɺඞ ͣνʔϜ಺ϨϏϡʔΛ͢Δ ɾϦʔμʔಉ࢜͸ޓ͍ʹϨϏϡʔ
  63. ଟஈ feature ϒϥϯν feature/hoge ϨϏϡʔίετͷ૿େ ɾ͓͓͖ͳϒϥϯν ɾͰ͖ΔݶΓɺϒϥϯν͸େ͖͘͠ͳ͍ ɹʢޙड़ʣ ɾ͚ͩͲɺେ͖͘ͳͬͯ͠·͏৔߹͕͋ Δ

    →ϨϏϡʔίετͷ૿େɾϙΠϯτ͕ζ ϨΔ → Pull Request ҙຯͳ͍
  64. ଟஈ feature ϒϥϯν feature/hoge feature/hoge-admin feature/hoge-batch mergeલʹ pull request ϨϏϡʔ

    mergeલʹ pull request ϨϏϡʔ
  65. ݁Ռ

  66. ࣗ෼ͷ୲౰Ҏ֎ͷ ෦෼ͷ࣮૷ɾ࢓༷ͷ ೺Ѳ͕Ͱ͖ΔΑ͏ʹͳΔ େࣄͳ͜ͱ͔ͩΒ΋͏౓

  67. ͓ޓ͍ʹɺͩΕ͕ Ͳ͏͍͏ίʔυΛ ॻ͘ͷ͔ΛΘ͔Δ Α͏ʹͳΔ େࣄͳ͜ͱ͔ͩΒ΋͏౓

  68. ίϐϖݩ͝ͱ ᓲ໓͢Δػձ͕Ͱ͖ͨ

  69. ͏·͍͘͘ίπ

  70. 1. Ͱ͖Δ͚ͩࡉ͔͘ϦϦʔε

  71. 2. খ͞ΊͷνʔϜʹ෼ׂ͢Δ

  72. ࠷ޙʹ

  73. GitΛ͔ͭͬͨνʔϜ։ൃ ɾʮSVNΛஔ͖׵͑ΔʯͰ͸ͳ͍ ɾ։ൃϑϩʔ͔Βߏங͠௚͢ ɾͥͻ Pull Request ϕʔεͷ։ൃΛ ɾେ͖ͳձࣾͰ͸ɺখ͞ͳϓϩδΣΫτ͔Β Ҡߦͯ͠ܒ໤͍ͯ͘͠ͳͲɺਐΊํʹ޻෉͕ ඞཁ

  74. ਖ਼ղ͸ͳ͍ ɾࣄྫ͸͋͘·Ͱࣄྫ ɾ૊৫ʹ͋ͬͨ΍Γ͔ͨΛݟ͚ͭΑ͏ʂ ɾ͖ͬ͞ͷ@halt͞Μͷ࿩ͱ͔ʂ ɾΠέͯͳ͍ͱ͜Ζ͸ͲΜͲΜվળ ɾ։ൃϑϩʔ/ۀ຿ϑϩʔ͸ৗʹݟ௚͢ ɾͥͻɺϊ΢ϋ΢ͷڞ༗͠·͠ΐ͏ʂ

  75. ࠷ޙʹ... ΤϯδχΞืू͍ͯ͠·͢ʂʂ ָ͍͠Αʂʂ ࣭͝໰ʁ strk.jp/w ʢ←ʂ