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
Slide 2
Slide 2 text
the best way to build and ship software 2
!
!
"
BRENT BEER
SALES ENGINEER
San Francisco, CA
Who am I?
GitHub
Slide 3
Slide 3 text
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.
Slide 4
Slide 4 text
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.
Slide 5
Slide 5 text
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
Slide 6
Slide 6 text
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
)
& & &
Slide 7
Slide 7 text
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
)
& & &
Slide 8
Slide 8 text
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
)
& & &
Slide 9
Slide 9 text
the best way to build and ship software
Guides
9
2
Slide 10
Slide 10 text
the best way to build and ship software
Guides
10
2
Slide 11
Slide 11 text
the best way to build and ship software
Guides
11
2
Slide 12
Slide 12 text
the best way to build and ship software
GitHub Engineering
12
)
Slide 13
Slide 13 text
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.
Slide 14
Slide 14 text
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.
Slide 15
Slide 15 text
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.
Slide 16
Slide 16 text
the best way to build and ship software
Basic Pull Request
16
,
Slide 17
Slide 17 text
the best way to build and ship software
What makes a good pull request?
17
,
,
HOW DO YOU USE THEM WELL?
Slide 18
Slide 18 text
“
”
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
Slide 19
Slide 19 text
“
”
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
Slide 20
Slide 20 text
“
”
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
Slide 21
Slide 21 text
“
”
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
Slide 22
Slide 22 text
“
”
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
Slide 23
Slide 23 text
the best way to build and ship software
Pull Requests with CI
23
4
Slide 24
Slide 24 text
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.
Slide 25
Slide 25 text
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.
Slide 26
Slide 26 text
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.
Slide 27
Slide 27 text
“
”
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
Slide 28
Slide 28 text
“
”
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
Slide 29
Slide 29 text
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.
Slide 30
Slide 30 text
the best way to build and ship software
Code review
30
5
Slide 31
Slide 31 text
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!
Slide 32
Slide 32 text
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
Slide 33
Slide 33 text
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
Slide 34
Slide 34 text
the best way to build and ship software
Code review: protected branches
34
6
Slide 35
Slide 35 text
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
Slide 36
Slide 36 text
the best way to build and ship software
Code review: ReviewNinja
36
6
Slide 37
Slide 37 text
the best way to build and ship software
Code review: protected branches
37
6
Slide 38
Slide 38 text
the best way to build and ship software
Code review: protected branches
38
6
Slide 39
Slide 39 text
the best way to build and ship software
Code review: protected branches
39
6
Slide 40
Slide 40 text
the best way to build and ship software
Code review: protected branches
40
6
Slide 41
Slide 41 text
the best way to build and ship software
Code review: protected branches
41
6
Slide 42
Slide 42 text
the best way to build and ship software
Code review: protected branches
42
6
Slide 43
Slide 43 text
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
Slide 44
Slide 44 text
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.
Slide 45
Slide 45 text
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.
Slide 46
Slide 46 text
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.
Slide 47
Slide 47 text
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
Slide 48
Slide 48 text
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
Slide 49
Slide 49 text
the best way to build and ship software
GitHub Flow
49
7
Slide 50
Slide 50 text
the best way to build and ship software
GitHub Flow
50
,
7
PULL REQUESTS
Help your development happen faster and
increase communication.
Slide 51
Slide 51 text
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.
Slide 52
Slide 52 text
the best way to build and ship software
Guides
52
2
Slide 53
Slide 53 text
the best way to build and ship software
Guides
53
2
Slide 54
Slide 54 text
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.
Slide 55
Slide 55 text
the best way to build and ship software
Slide 56
Slide 56 text
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