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

How GitHub Uses GitHub to Build GitHub

Zach Holman
September 21, 2011

How GitHub Uses GitHub to Build GitHub

Build features fast. Ship them. That's what we try to do at GitHub. Our process is the anti-process: what's the minimum overhead we can put up with to keep our code quality high, all while building features *as quickly as possible*? It's not just features, either: faster development means happier developers.

Zach Holman

September 21, 2011
Tweet

More Decks by Zach Holman

Other Decks in Programming

Transcript

  1. github
    how
    uses
    to build zach holman

    View full-size slide

  2. github
    how
    uses
    to build
    x

    View full-size slide

  3. github
    how
    uses
    to build
    github
    github

    View full-size slide

  4. how
    uses
    to build
    github

    View full-size slide

  5. how
    uses
    to build
    github

    View full-size slide

  6. how
    uses
    to build
    github
    your company
    your product

    View full-size slide

  7. we work
    asynchronously

    View full-size slide

  8. WORKING ASYNCHRONOUSLY:
    YOU CAN DO SHIT WITHOUT NEEDING TO
    PULL ME OUT OF THE ZONE™.
    NO MEETINGS • NO DEADLINES • NO MANAGERS

    View full-size slide

  9. CHATROOMS
    NO PRESENCE NEEDED
    LOG ALL THE THINGS
    EVERYONE ON THE SAME PAGE
    TIME FLEXIBILITY
    WORK WHEN YOU WANT TO WORK

    View full-size slide

  10. HOW GITHUB WORKS
    zachholman.com/posts/how-github-works

    View full-size slide

  11. PULL REQUESTS + BRANCHING
    ISSUES
    OAUTH AS IDENTITY
    HOOKS & HUBOT
    SECRETS
    OKAY LET’S TALK ABOUT

    View full-size slide

  12. +
    pull requests
    branching

    View full-size slide

  13. Y’all got some weird branches.

    View full-size slide

  14. master
    deploy-62
    deploy-63
    deploy-63b
    deploy-
    ?

    View full-size slide

  15. REPOSITORY
    TRUSTED
    DEVELOPERS
    FORK FORK FORK
    SHITTY
    DEVELOPERS
    ʘ‿ʘ ಠ_ಠ

    View full-size slide

  16. Keep your branches simple.

    View full-size slide

  17. How GitHub does branching:

    View full-size slide

  18. MASTER
    BRANCH

    View full-size slide

  19. Everyone can push, everyone can deploy.

    View full-size slide

  20. Frees up your time from
    micromanaging someone else’s code.

    View full-size slide

  21. Master is always deployable.

    View full-size slide

  22. Master is always deployable. We deploy
    10-40 times a day.

    View full-size slide

  23. If you’re nervous, deploy to staging.
    Or deploy a branch. Or deploy to a subset
    of our production boxes.
    TWITTER-DRIVEN DEVELOPMENT
    CHECK TWITTER, SEE IF YOU BONED A DEPLOY

    View full-size slide

  24. Keep your branches simple.

    View full-size slide

  25. What about code quality?
    ಠ_ಠ

    View full-size slide

  26. REQUESTS
    PULL
    OOH! FUTURISTIC!

    View full-size slide

  27. Pull Requests are our code review.

    View full-size slide

  28. DISCUSSIONS DISCUSSIONS DISCUSSIONS DISCUS
    DISCUSSIONS DISCUSSIONS DISCUSSIONS DISCUS
    DISCUSSIONS DISCUSSIONS DISCUSSIONS DISCUS
    DISCUSSIONS DISCUSSIONS DISCUSSIONS DISCUS
    DISCUSSIONS DISCUSSIONS DISCUSSIONS DISCUS
    DISCUSSIONS DISCUSSIONS DISCUSSIONS DISCUS
    DISCUSSIONS DISCUSSIONS DISCUSSIONS DISCUS
    DISCUSSIONS DISCUSSIONS DISCUSSIONS DISCUS
    DISCUSSIONS DISCUSSIONS DISCUSSIONS DISCUS
    WHATPULL REQUESTS?
    ARE

    View full-size slide

  29. A PULL REQUEST IS A DISCUSSION
    CODE DISCUSSION
    FEATURE DISCUSSION
    STRATEGY DISCUSSION

    View full-size slide

  30. CODE DISCUSSION
    FEATURE DISCUSSION
    STRATEGY DISCUSSION

    View full-size slide

  31. REFERENCE ISSUES
    REVIEW CODE DIFFS
    WRITE CODE COMMENTS
    CODE DISCUSSION
    FEATURE DISCUSSION
    STRATEGY DISCUSSION

    View full-size slide

  32. REFERENCE ISSUES
    REVIEW CODE DIFFS
    WRITE CODE COMMENTS
    CODE DISCUSSION
    FEATURE DISCUSSION
    STRATEGY DISCUSSION
    ALL ON A BRANCH

    View full-size slide

  33. TITLE OF THE PULL REQUEST
    DESCRIPTION
    COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT
    COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT
    COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT
    COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT
    DISCUSS DISCUSS DISCUSS DISCUSS DISCUSS
    DISCUSS DISCUSS DISCUSS DISCUSS DISCUSS
    COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT COMMIT

    View full-size slide

  34. talk about changes
    show all commits
    show specific code changes

    View full-size slide

  35. MASTER
    BRANCH

    View full-size slide

  36. MASTER
    BRANCH
    PULL REQUEST

    View full-size slide

  37. BIG SECRET #1
    PULL REQUESTS:
    YOU DON’T NEED
    TO FORK ANYTHING.

    View full-size slide

  38. WHY PULL REQUESTS ARE RAD:
    REASONS
    4

    View full-size slide

  39. WHY PULL REQUESTS ARE RAD: ASYNCHRONOUS
    No meetings.

    View full-size slide

  40. WHY PULL REQUESTS ARE RAD: NOTIFICATIONS
    Email is your interface.

    View full-size slide

  41. WHY PULL REQUESTS ARE RAD: ACCESSIBLE
    Designers can evolve mockups
    and entire workflows.
    Non-technical staff can add
    their two cents.

    View full-size slide

  42. WHY PULL REQUESTS ARE RAD: HISTORICAL
    Pull Requests can be experiments.
    Try something out, throw it
    away, retain a history.

    View full-size slide

  43. GitHub’s Pull Requests

    View full-size slide

  44. Realtime™ status.github.com real-time polling
    git (ssh): true
    git (http): true
    git (git://): true
    downloads: true
    pages: true
    svn: true
    SUDDENLY,
    a design

    View full-size slide

  45. Realtime™ status.github.com real-time polling
    POST SCREENSHOTS
    MIX YOUR DESIGNERS + DEVELOPERS
    (AND .GIFs!)

    View full-size slide

  46. CodeMirror syntax highlighting as you type

    View full-size slide

  47. CodeMirror syntax highlighting as you type
    PULL REQUESTS ARE CHEAP AS HELL
    DON’T BE AFRAID TO TOSS IT ALL AWAY

    View full-size slide

  48. Don’t be afraid to
    try to (gently) break GitHub.
    8 months,
    couple hundred commits,
    dozens of mockups
    {

    View full-size slide

  49. Pull Requests are
    about getting shit done
    without wasting a lot of time.

    View full-size slide

  50. Can your workflow be improved?
    Do you really need all that process?

    View full-size slide

  51. USE PULL REQUESTS MORE
    SPEND LESS TIME AVOIDING SHIPPING
    PULL REQUEST RECAP

    View full-size slide

  52. issues
    we have

    View full-size slide

  53. priorities
    estimates
    rich media things
    deadlines
    redundant
    wat
    more priorities
    just trolling us now
    where am i anyway

    View full-size slide

  54. Can you survive on
    tools?
    SIMPLER

    View full-size slide

  55. Can you work faster on
    tools?
    SIMPLER

    View full-size slide

  56. Can you work better on
    tools?
    SIMPLER

    View full-size slide

  57. Merlin Mann
    @hotdogsladies
    on email priorities :

    View full-size slide

  58. A priority is observed, not
    manufactured or assigned.
    Otherwise, it's necessarily not
    a priority.

    View full-size slide

  59. Making something a BIG RED TOP TOP
    BIG HIGHEST #1 PRIORITY changes
    nothing but text styling.
    If it were really important, it'd
    already be done. Period.

    View full-size slide

  60. PRIORITIES
    DEADLINES
    ASSIGNEES
    ESTIMATES

    View full-size slide

  61. Resist adding meta-work. It gets in
    the way of doing real work. (The real
    work will get done anyway.)

    View full-size slide

  62. 3We use Issues for three things.

    View full-size slide

  63. shit, something is broken

    View full-size slide

  64. hey, this could be cool

    View full-size slide

  65. Do you need more than that?
    Think about it.
    Most of the time, you don’t.

    View full-size slide

  66. MEANS MORE TIME BUILDING
    YOUR PRODUCT
    ISSUES RECAP
    SIMPLE TOOLS

    View full-size slide

  67. oauthas identity

    View full-size slide

  68. RUBY IS SO FAST
    FUCK
    I LOVE IT
    SO MUCH

    View full-size slide

  69. ~/Development/SECRETARYOFLABOR
    self-referential symlink `what`
    single LABOR.RB web app
    was super hammered when I wrote this
    ~/Development/unmarked_van
    an app that stalks people’s locations
    ~/Development/trace
    real-time stats graphing

    View full-size slide

  70. continuous
    integration
    internal app
    distribution
    collectd
    graphs
    internal
    talk videos
    30
    INTERNAL APPS
    arbitrary
    data store
    internal
    twitter
    ios licensing +
    provisioning
    haystack
    exceptions

    View full-size slide

  71. Outsiders are
    not welcome.

    View full-size slide

  72. GitHub as Authentication
    TEAMS, ORGANIZATIONS, AND USERS

    View full-size slide

  73. GitHub as Authentication
    USE OAUTH TO AUTHENTICATE USERS

    View full-size slide

  74. github.com/atmos/sinatra_auth_github
    github_organization_access?('github')
    # => true

    View full-size slide

  75. GitHub as Authentication
    SECURITY • CONSISTENCY • COOLICTY

    View full-size slide

  76. DON’T REINVENT THE WHEEL
    YOUR AUTHENTICATION CAN BE FREE
    OAUTH RECAP

    View full-size slide

  77. hooks &hubot

    View full-size slide

  78. HUBOT
    OUR FRIENDLY CAMPFIRE BOT

    View full-size slide

  79. OVER 300 COMMANDS, LIKE...
    • deploy every GitHub app
    • run branch-level tests
    • play music in the office
    • tell us who is in the office
    • dynamically build usage graphs
    • send and receive text messages
    • mustache every image posted in chat
    • track who swears each day
    • rank by twitter followers
    • ...and way, way more

    View full-size slide

  80. github.com/github/hubot
    Hubot is not open source.
    LOL JK

    View full-size slide

  81. bots — github: know your branch status
    hubot what hasn’t been deployed?
    Zach
    Hubot
    Zach: Here's what hasn't been deployed on master yet:
    https://github.com/github/github/compare/{sha}...master

    View full-size slide

  82. bots — github: know your branch status
    hubot what hasn’t been deployed on issues2?
    Zach
    Hubot
    Zach: Here's what hasn't been deployed on issues2 yet:
    https://github.com/github/github/compare/{sha}...issues2

    View full-size slide

  83. bots — github: know your branch status
    hubot what hasn’t been deployed on issues2?
    Zach
    Hubot
    Zach: Here's what hasn't been deployed on issues2 yet:
    https://github.com/github/github/compare/{sha}...issues2

    View full-size slide

  84. bots — github: know your branch status
    hubot what hasn’t been deployed on issues2?
    Zach
    Hubot
    Zach: Here's what hasn't been deployed on issues2 yet:
    https://github.com/github/github/compare/{sha}...issues2

    View full-size slide

  85. https://github.com/site/sha
    bots — github: know your branch status
    #=> 2c8c2e9932d0caceecd3ed8ee2adcda0ece3e564

    View full-size slide

  86. bots — github: using the API
    hubot what are the pulls on holman/boom?
    Zach
    Hubot
    HTTParty should only be a soft dependency
    (master...jimmycuadra:soft-dependency) by jimmycuadra
    https://github.com/holman/boom/pull/46
    boom roulette (master...culvr:master) by culvr
    https://github.com/holman/boom/pull/43

    View full-size slide

  87. bots — github: using the API
    hubot how many issues did we close today for github/github?
    Zach
    Hubot
    13 issues closed on github/github in the past 24 hours.

    View full-size slide

  88. bots — github
    What does your company do over and over again?
    Can you automate that?

    View full-size slide

  89. HUBOT RECAP
    HUBOT KNOWS WHERE YOU LIVE
    DO NOT TRUST HIM

    View full-size slide

  90. secrets
    everyone has

    View full-size slide

  91. WE TUCK STUFF AWAY SOMETIMES. OOPS.

    View full-size slide

  92. EMOJI
    :heart:
    WORDS ARE FOR ACADEMICS, BRO
    :+1: :shipit:
    http://git.io/dmWZWg
    ...and so much more:

    View full-size slide

  93. SHORTCUTS
    QUIT MAKING ME DO THINGS ALL SLOW-LIKE
    w t ?

    View full-size slide

  94. IMAGES
    EVERYTHING IS BETTER WITH PIXELS
    ![title](url)

    View full-size slide

  95. DIFF+PATCH
    GOD I HATE PIXELS JUST GIVE ME TEXT
    .diff + .patch
    after most URLs

    View full-size slide

  96. require 'redcarpet'
    markdown = Redcarpet.new("Hello World!")
    puts markdown.to_html
    FENCED CODE
    IT’S LIKE CODE BUT WITH MORE FENCES

    View full-size slide

  97. ```ruby
    require 'redcarpet'
    markdown = Redcarpet.new("Hello World!")
    puts markdown.to_html
    ```
    FENCED CODE
    IT’S LIKE CODE BUT WITH MORE FENCES

    View full-size slide

  98. FENCED CODE
    IT’S LIKE CODE BUT WITH MORE FENCES
    require 'redcarpet'
    markdown = Redcarpet.new("Hello World!")
    puts markdown.to_html

    View full-size slide

  99. MENTIONS
    GET SOMEONE ELSE TO DO YOUR WORK
    @username
    pull requests
    issues
    commits

    View full-size slide

  100. WHITESPACE
    IT SUCKS
    add
    ?w=1
    to URLs

    View full-size slide

  101. REPO REFERENCES
    AROUND THE REPO, AROUND THE REPO, AROUND
    user/repo#issue

    View full-size slide

  102. GIT.IO
    OFFICIAL LAUNCH ANNOUNCEMENT
    https://github.com/holman/really-
    fucking-long-url-wtf-is-u-doing
    git.io/url

    View full-size slide

  103. GIT.IO
    OFFICIAL LAUNCH ANNOUNCEMENT
    http://git.io/nxVVig
    curl -i http://git.io -F 'url=#{url}' #{code}

    View full-size slide

  104. TOOLS + PROCESS = PRODUCT
    SIMPLE BETTER AWESOME
    THE BIG RECAP

    View full-size slide

  105. zach holman
    zachholman.com/talks
    @holman
    twitter+github:

    View full-size slide