Guide to Social Coding

626ca235e8dab778c5bad6fc10e94ad8?s=47 Sorah Fukumori
September 15, 2012

Guide to Social Coding

626ca235e8dab778c5bad6fc10e94ad8?s=128

Sorah Fukumori

September 15, 2012
Tweet

Transcript

  1. GUIDE TO SOCIAL CODING

  2. @sora_h

  3. ͦΒ͸ʔ soraŋher

  4. Shota Fukumori

  5. @sora_h Ruby committer

  6. @sora_h Ruby committer தଔϑϦʔλʔ

  7. @sora_h Ruby committer தଔϑϦʔλʔ github.com/sorah

  8. @sora_h Ruby committer தଔϑϦʔλʔ →sorah.jp

  9. ఏڙ

  10. This talk may seems promoting an one company I’m thinking

    this talk is not promotion GitHub is tool to code socially, right? DISCLAIMER
  11. QUICK SURVEY (raise your hand)

  12. QUICK SURVEY 1 (raise your hand) HAVE A GITHUB ACCOUNT

  13. QUICK SURVEY 2 (raise your hand) USING GITHUB TO PUBLISH

    CODE
  14. QUICK SURVEY 3 (raise your hand) I HAVE AN ACCOUNT,

    BUT DOING NOTHING
  15. QUICK SURVEY 4 (raise your hand) I’VE SENT PULL REQUEST

  16. QUICK SURVEY 5 (raise your hand) COLLABORATING AT PRIVATE REPO

  17. QUICK SURVEY 6 (raise your hand) USING GITHUB ENTERPRISE

  18. SOCIAL CODING

  19. None
  20. Ruby community founds GitHub

  21. GitHub and Ruby go together

  22. GitHub —Ruby

  23. None
  24. (today’s) most common tool for Social Coding

  25. HOW SOCIAL Follow people Star/watch projects Commit (line) note

  26. HOW SOCIAL Fork & Pull Request

  27. FORK & PULL REQUEST

  28. FORK someone/project me/project

  29. FORK USE CASE To customize

  30. FORK USE CASE To customize To write a patch

  31. FORK USE CASE To write a patch

  32. PULL REQUEST A WAY TO SEND A PATCH is

  33. PULL REQUEST WAY TO SEND A PATCH is a SHARED

  34. PULL REQUEST WAY TO SEND A PATCH is a EASY

  35. You can send a patch in just 4 STEPS

  36. Fork Commit Push Pull Request

  37. any projects any available at hosted in GitHub

  38. FORK PULL REQUEST We can’t disable

  39. We can easily send a patch to any projects in

    same protocol
  40. but some projects are accepting patches at another place (Redmine,

    etc)
  41. but some projects are accepting patches at another place (Redmine,

    etc) e.g. ruby/ruby
  42. None
  43. HOW TO PULL REQUEST

  44. HOW TO PULL REQUEST Best Practices

  45. YES, the main subject of this talk

  46. 1 Feel a problem

  47. 1 Feel a problem BUG Fix by your hand

  48. 1 Feel a problem FEATURE Implement it!

  49. Fork the repo 2

  50. Fork the repo 2

  51. Fork the repo then clone it. 2

  52. TIME TO HACK 2

  53. 2 But, don’t forget to create & checkout TOPIC BRANCH

  54. 2 But, don’t forget to create & checkout It’s not

    required, but recommended. TOPIC BRANCH
  55. BEST PRACTICE 1 USE TOPIC BRANCH git checkout -b foo

    master
  56. COMMIT & PUSH 3

  57. OPEN github.com/<you>/<repo> then choose the branch 4

  58. PRO TIP USE [W] key To quickly open branch/tag chooser

  59. CLICK “Pull Request” THEN TYPE A DESCRIPTION OF YOUR PATCH

    5
  60. BEST PRACTICE KEEP TITLE SIMPLY

  61. BEST PRACTICE 2 for bug fix INCLUDE TINY REPRODUCE STEP

  62. BEST PRACTICE 2 for bug fix INCLUDE WHAT HAPPENED &

    EXPECTED
  63. BEST PRACTICE 2 for feature adding INCLUDE USE CASES &

    USAGE
  64. BEST PRACTICE 2 for feature adding TEST?

  65. BEST PRACTICE 3 headers make description readable.

  66. BEST PRACTICE 4 WRITE IN ENGLISH ӳޠॻ͚ (ओʹ)೔ຊਓ޲͚ ͨͱ͑૬ख͕೔ຊਓͰ΋ͳ!

  67. BEST PRACTICE 4 CANNOT? LEARN! Ͱ͖ͳ͍? ษڧ͠·͠ΐ͏

  68. BEST PRACTICE 4 CODE IS USEFUL TO EXPLAIN ίʔυͰޠΔͷ͸ΞϦ

  69. BEST PRACTICE 4 Not bad, ೤ҙ΋͋Γ? https://github.com/igrigorik/em-websocket/pull/91

  70. SEND! 6

  71. Wait for a response Answer for reply 7

  72. EXAMPLES

  73. komagata/lokka #90 if wp:post_type is not post, page or attachment,

    variable model will be nil, and it makes NoMethodError at line 55.
  74. komagata/lokka #121 WordPress ͱಉ͡Α͏ʹ Post ʹରͯ͠ͷ URL ΛΧελϚΠ ζͰ͖ΔΑ͏ʹ͠·ͨ͠ɽ This

    patch provides customizable Post's URL as like as WordPress.
  75. komagata/lokka #121 ͜ͷػೳ͸ Wordpress Ͱ͢Ͱ ʹ࢖͍ͬͯΔਓ (Θͨ͠ͷΑ͏ ͳ) ͸طଘͷϦϯΫΛແବʹ ͠ͳ͍ͨΊʹҠߦʹ͸ඞਢͩ

    ͱ૝͍·͢ɽ
  76. komagata/lokka #121 Some people (including me!) can't move (from WordPress)

    to Lokka because there is no custom permalink feature… :(
  77. sinatra/sinatra #57 I fixed for ruby1.9.2-p0.

  78. sinatra/sinatra #57

  79. sinatra/sinatra #57 https://github.com/rkh/sinatra/commit/ 8a3aea14a2301a0f56689591dee12ac8966472c7

  80. TIP: BE CAREFUL TO DUPES

  81. None
  82. COLLABORATION USING PULL REQUEST

  83. tl;dr Benefit: Use pull request for reviewing codes!

  84. We can send pull request to the same repository.

  85. of course, available both public & private repository

  86. GIT FLOW

  87. GIT FLOW Case of sinsai.info

  88. sinsai.info Portal site for Victims of the big earthquake at

    Mar 11, 2011
  89. sinsai.info Many volunteers, developed on GitHub (private + public repo)

  90. Flow at sinsai.info Create issue Push topic branch Pull Request

    Confirm & Merge
  91. Flow at sinsai.info Create issue Push topic branch Pull Request

    Confirm & Merge ×
  92. Flow at sinsai.info Create issue on redmine Push topic branch

    Redmine status: “Waiting to merge” Confirm & Merge
  93. Flow at sinsai.info I didn’t know we can send Pull

    Request in the same repository then…
  94. REVIEWING Line notes at Pull Request’s diff page useful to

    code reviewing
  95. REVIEWING

  96. REVIEWING

  97. REVIEWING

  98. PRO TIP :emoji: http://emoji-cheat-sheet.com/

  99. PRO TIP :+1: :sushi: :trollface: :emoji:

  100. FOR PRIVATE THINGS

  101. We can push private things on GitHub and use socially

    features
  102. if you’re paying money to GitHub (but students can get

    micro account at free, ͏Β΍·͍͠ͳ͋)
  103. For enterprise: GitHub:enterprise provides internal installation (VM image)

  104. PRO TIP USE `hub` defunkt/hub

  105. PRO TIP Attach a patch to issue; Convert an issue

    to pull request USE `hub`
  106. Let’s social coding CONCLUSION

  107. HAVE FUN

  108. THANK YOU