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 Slide

  2. github
    how
    uses
    to build
    x

    View Slide

  3. github
    how
    uses
    to build
    github
    github

    View Slide

  4. how
    uses
    to build
    github

    View Slide

  5. how
    uses
    to build
    github

    View Slide

  6. how
    uses
    to build
    github
    your company
    your product

    View Slide

  7. @holman

    View Slide

  8. View Slide

  9. we work
    asynchronously

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  14. +
    pull requests
    branching

    View Slide

  15. Y’all got some weird branches.

    View Slide

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

    View Slide

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

    View Slide

  18. Keep your branches simple.

    View Slide

  19. How GitHub does branching:

    View Slide

  20. MASTER
    BRANCH

    View Slide

  21. Everyone can push, everyone can deploy.

    View Slide

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

    View Slide

  23. Master is always deployable.

    View Slide

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

    View Slide

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

  26. Keep your branches simple.

    View Slide

  27. What about code quality?
    ಠ_ಠ

    View Slide

  28. REQUESTS
    PULL
    OOH! FUTURISTIC!

    View Slide

  29. Pull Requests are our code review.

    View Slide

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

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

    View Slide

  32. CODE DISCUSSION
    FEATURE DISCUSSION
    STRATEGY DISCUSSION

    View Slide

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

    View Slide

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

    View Slide

  35. View Slide

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

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

    View Slide

  38. MASTER
    BRANCH

    View Slide

  39. MASTER
    BRANCH
    PULL REQUEST

    View Slide

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

    View Slide

  41. WHY PULL REQUESTS ARE RAD:
    REASONS
    4

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  46. GitHub’s Pull Requests

    View Slide

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

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

    View Slide

  49. CodeMirror syntax highlighting as you type

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  55. issues
    we have

    View Slide

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

    View Slide

  57. View Slide

  58. Can you survive on
    tools?
    SIMPLER

    View Slide

  59. Can you work faster on
    tools?
    SIMPLER

    View Slide

  60. Can you work better on
    tools?
    SIMPLER

    View Slide

  61. Merlin Mann
    @hotdogsladies
    on email priorities :

    View Slide

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

    View Slide

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

  64. PRIORITIES
    DEADLINES
    ASSIGNEES
    ESTIMATES

    View Slide

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

    View Slide

  66. 3We use Issues for three things.

    View Slide

  67. shit, something is broken

    View Slide

  68. hey, this could be cool

    View Slide

  69. todo lists

    View Slide

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

    View Slide

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

    View Slide

  72. oauthas identity

    View Slide

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

    View Slide

  74. ~/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 Slide

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

    View Slide

  76. Outsiders are
    not welcome.

    View Slide

  77. GitHub as Authentication
    TEAMS, ORGANIZATIONS, AND USERS

    View Slide

  78. GitHub as Authentication
    USE OAUTH TO AUTHENTICATE USERS

    View Slide

  79. View Slide

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

    View Slide

  81. GitHub as Authentication
    SECURITY • CONSISTENCY • COOLICTY

    View Slide

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

    View Slide

  83. hooks &hubot

    View Slide

  84. HUBOT
    OUR FRIENDLY CAMPFIRE BOT

    View Slide

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

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

    View Slide

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

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

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

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

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

    View Slide

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

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

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

    View Slide

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

    View Slide

  96. secrets
    everyone has

    View Slide

  97. WE TUCK STUFF AWAY SOMETIMES. OOPS.

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  111. thanks!

    View Slide

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

    View Slide