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

Pull Request, code review and the GitHub Flow

Brent Beer
October 01, 2015

Pull Request, code review and the GitHub Flow

Pull Requests are one of most essential workflow pieces of modern application development. If used effectively with proper code review and your existing workflow, they can not only help ensure high quality of written code, but do so without sacrificing the speed of development.
We'll start out by looking at what makes a great pull request, and what barriers people have with sending and receiving them. Next, we'll remove some of those barriers by discussing some code review best practices to ensure the code we're writing is well written and well tested. Lastly, we'll see how and why these pieces are a crucial part of a proper workflow, and what advantages the GitHub Flow has.

Brent Beer

October 01, 2015
Tweet

More Decks by Brent Beer

Other Decks in Technology

Transcript

  1. the best way to build and ship software Pull Requests,

    code review, and the GitHub Flow What are these things, why are they important, and how can they make everyone’s lives better
  2. the best way to build and ship software 2 !

    ! " BRENT BEER SALES ENGINEER San Francisco, CA Who am I? GitHub
  3. the best way to build and ship software What we’re

    about to talk about 3 # $ $ WHAT’S OUR GOAL HERE? HOW ARE WE GETTING THERE? Talk about Pull Requests and understand how to use them effectively. How can we maintain quality of code without requiring our developers to have meetings that ruin productivity. What is the GitHub Flow? Why should you care? How does all this tie together? Better understanding of what Pull Requests, code review, and the GitHub Flow.
  4. the best way to build and ship software What we’re

    about to talk about 4 # $ $ WHAT’S OUR GOAL HERE? HOW ARE WE GETTING THERE? Talk about Pull Requests and understand how to use them effectively. How can we maintain quality of code without requiring our developers to have meetings that ruin productivity. What is the GitHub Flow? Why should you care? How does all this tie together? Better understanding of what Pull Requests, code review, and the GitHub Flow.
  5. the best way to build and ship software Traditional software

    development 5 % issues, bugs, features backlog sprint planning & ! % ' ( continuous integration code review sprint review ) ' * ' + no go go no go go no go go
  6. the best way to build and ship software What you’d

    like to have 6 , issues, bugs, features backlog collaboration + , ' ! - continuous deploy merge (master) deploy to production . ) / 0 close merge ) & & &
  7. the best way to build and ship software GitHub’s software

    development 7 1 issues, bugs, features backlog collaboration + , ' ! - continuous deploy merge (master) deploy to production . ) / 0 close merge ) & & &
  8. the best way to build and ship software GitHub’s software

    development 8 1 issues, bugs, features backlog collaboration + , ' ! - continuous deploy merge (master) deploy to production . ) / 0 close merge ) & & &
  9. the best way to build and ship software Pull Requests

    13 , , WHAT ARE PULL REQUESTS? Pull requests are proposed changes from one branch to another. They are more than just changes, they are the start of a discussion.
  10. the best way to build and ship software Pull Requests

    14 , , WHAT ARE PULL REQUESTS? Pull requests are proposed changes from one branch to another. They are more than just changes, they are the start of a discussion.
  11. the best way to build and ship software Pull Requests

    15 , , HOW DO YOU USE THEM? When you create a new branch and make some changes, you can propose those changes to be merged into master.
  12. the best way to build and ship software What makes

    a good pull request? 17 , , HOW DO YOU USE THEM WELL?
  13. “ ” the best way to build and ship software

    18 3 NATURALLY, THE SIZE OF THE PULL REQUEST MATTERS: THE SHORTER IT IS THE FASTER IT WILL BE REVIEWED. OTHER ACTIONABLE STRONG PREDICTORS ARE THE DELAY TO THE FIRST HUMAN RESPONSE AND THE AVAILABILITY OF THE CI PIPELINE. IMPROVING ON BOTH MAY HASTEN THE REVIEW PROCESS. - WAIT FOR IT: DETERMINANTS OF PULL REQUEST EVALUATION LATENCY ON GITHUB Research
  14. “ ” the best way to build and ship software

    19 3 NATURALLY, THE SIZE OF THE PULL REQUEST MATTERS: THE SHORTER IT IS THE FASTER IT WILL BE REVIEWED. OTHER ACTIONABLE STRONG PREDICTORS ARE THE DELAY TO THE FIRST HUMAN RESPONSE AND THE AVAILABILITY OF THE CI PIPELINE. IMPROVING ON BOTH MAY HASTEN THE REVIEW PROCESS. - WAIT FOR IT: DETERMINANTS OF PULL REQUEST EVALUATION LATENCY ON GITHUB Research
  15. “ ” the best way to build and ship software

    20 3 NATURALLY, THE SIZE OF THE PULL REQUEST MATTERS: THE SHORTER IT IS THE FASTER IT WILL BE REVIEWED. OTHER ACTIONABLE STRONG PREDICTORS ARE THE DELAY TO THE FIRST HUMAN RESPONSE AND THE AVAILABILITY OF THE CI PIPELINE. IMPROVING ON BOTH MAY HASTEN THE REVIEW PROCESS. - WAIT FOR IT: DETERMINANTS OF PULL REQUEST EVALUATION LATENCY ON GITHUB Research
  16. “ ” the best way to build and ship software

    21 3 NATURALLY, THE SIZE OF THE PULL REQUEST MATTERS: THE SHORTER IT IS THE FASTER IT WILL BE REVIEWED. OTHER ACTIONABLE STRONG PREDICTORS ARE THE DELAY TO THE FIRST HUMAN RESPONSE AND THE AVAILABILITY OF THE CI PIPELINE. IMPROVING ON BOTH MAY HASTEN THE REVIEW PROCESS. - WAIT FOR IT: DETERMINANTS OF PULL REQUEST EVALUATION LATENCY ON GITHUB Research
  17. “ ” the best way to build and ship software

    22 3 NATURALLY, THE SIZE OF THE PULL REQUEST MATTERS: THE SHORTER IT IS THE FASTER IT WILL BE REVIEWED. OTHER ACTIONABLE STRONG PREDICTORS ARE THE DELAY TO THE FIRST HUMAN RESPONSE AND THE AVAILABILITY OF THE CI PIPELINE. IMPROVING ON BOTH MAY HASTEN THE REVIEW PROCESS. - WAIT FOR IT: DETERMINANTS OF PULL REQUEST EVALUATION LATENCY ON GITHUB Research
  18. the best way to build and ship software Pull Requests

    24 , , SUMMARY - Use Pull Request. - Create your pull request early. - Use CI to ensure your pull request is merged with confidence.
  19. the best way to build and ship software Code review

    25 5 5 WHAT IS CODE REVIEW Types of code review may vary. It can range from telling your collaborators that you looked that the pull request, to having a meeting.
  20. the best way to build and ship software Code review

    26 5 5 WHAT IS CODE REVIEW Types of code review may vary. It can range from telling your collaborators that you looked that the pull request, to having a meeting.
  21. “ ” the best way to build and ship software

    27 5 “PEER CODE REVIEWS ARE THE SINGLE BIGGEST THING YOU CAN DO TO IMPROVE YOUR CODE.” - JEFF ATWOOD Code review
  22. “ ” the best way to build and ship software

    28 3 “PEER CODE REVIEWS ARE THE SINGLE BIGGEST THING YOU CAN DO TO IMPROVE YOUR CODE.” - JEFF ATWOOD Code review
  23. the best way to build and ship software Code review

    29 5 5 HOW DO YOU CODE REVIEW There are many ways to start reviewing code. Start small and grow from there.
  24. the best way to build and ship software Code review

    31 5 5 STRONGER CODE REVIEW What if we want to ensure some things happen before we can even merge? CI needs to pass, someone needs to sign off!
  25. the best way to build and ship software Code review:

    protected branches 32 6 6 PROTECTED BRANCHES - Protect against force pushes and branch deletion - Require status checks to pass
  26. the best way to build and ship software Code review:

    protected branches 33 6 6 PROTECTED BRANCHES - Protect against force pushes and branch deletion - Require status checks to pass
  27. the best way to build and ship software Code review:

    protected branches 35 6 6 PROTECTED BRANCHES - Protect against force pushes and branch deletion - Require status checks to pass
  28. the best way to build and ship software Code review:

    protected branches 43 6 6 SUMMARY - If you need code review, decide what’s best for your team - Protected branches can help ensure status checks are green - If you want more code review, use the API or a service like ReviewNinja
  29. the best way to build and ship software GitHub Flow

    44 7 7 WHAT IS THE GITHUB FLOW At it's core, GitHub Flow is a lightweight, branch-based workflow that supports teams and projects where deployments are made regularly.
  30. the best way to build and ship software GitHub Flow

    45 7 7 WHAT IS THE GITHUB FLOW At it's core, GitHub Flow is a lightweight, branch-based workflow that supports teams and projects where deployments are made regularly.
  31. the best way to build and ship software GitHub Flow

    46 7 7 WHAT IS THE GITHUB FLOW At it's core, GitHub Flow is a lightweight, branch-based workflow that supports teams and projects where deployments are made regularly.
  32. the best way to build and ship software GitHub Flow

    47 7 B U I L D C O L L A B O R AT E D E P L O Y Time spent coding: Bugs are found: Code Reviews: Deployment: Target 75-90% At time of push (CI) Code reviewed at time of push Based on automation rules Current 10-25% During code review Once a week Ops and PMO decide 
 when to deploy Example Developer Calendar Example Developer Calendar
  33. the best way to build and ship software GitHub Flow

    48 7 B U I L D C O L L A B O R AT E D E P L O Y Time spent coding: Bugs are found: Code Reviews: Deployment: Target 75-90% At time of push (CI) Code reviewed at time of push Based on automation rules Current 10-25% During code review Once a week Ops and PMO decide 
 when to deploy Example Developer Calendar Example Developer Calendar
  34. the best way to build and ship software GitHub Flow

    50 , 7 PULL REQUESTS Help your development happen faster and increase communication.
  35. the best way to build and ship software GitHub Flow

    51 5 7 CODE REVIEW Ensure the code you write is reviewed and good quality code.
  36. the best way to build and ship software GitHub Flow

    54 7 7 GITHUB FLOW Work with a light-weight flexible workflow that helps your developers ship code faster.
  37. the best way to build and ship software References 56

    2 2 MANY PEOPLE HAVE TALKED ON THESE SUBJECTS - Why code reviews matter (and actually save time!): https://www.atlassian.com/ agile/code-reviews - When to do code reviews when doing CI: http://programmers.stackexchange.com/ questions/121664/when-to-do-code-reviews-when-doing-continuous-integration - Fog Creek( Jeff Atwood quote) on when to do code review: http:// blog.fogcreek.com/effective-code-reviews-9-tips-from-a-converted-skeptic/ - Wait For It: Determinants of Pull Request Latency on GitHub: https:// bvasiles.github.io/papers/msr15.pdf - Why You Should Use Continuous Integration and Continuous Deployment: http:// blog.teamtreehouse.com/use-continuous-integration-continuous-deployment