Top Banner
Push better software with Pull Requests Rob Moore Lead Consultant, Readify [email protected] @robdmoore
51

Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify [email protected] @robdmoore

Jul 27, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Push better software with Pull  Requests  Rob Moore Lead Consultant, Readify [email protected] @robdmoore

Page 2: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

What even is a Pull  Request anyway?

2

Page 3: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page 3

Pull Request Github.com/Org/Repo

Local Repository

Github.com/Rob/Repo Fork!

Clone

Page 4: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page 4

Pull Request Github.com/Org/Repo

Local Repository

Github.com/Rob/Repo Fork!

Push changes into Fork

Pull Request

Page 5: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Let’s see a Pull  Request in action!

5

Page 6: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Pull  Requests: the bedrock of modern OSS development

6

Page 7: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

› Random third parties › Easy and effective › Contextual conversations › Keep track of core team

7

Contributors

Page 8: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Maintainers › Easier/more contributions › Contextual conversations › Get code ready to merge › Fosters collaborative community › Review all code

8

Page 9: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page Coordinate distributed WIP 9

master featurex rob/featurex

Make Branch

Open Pull Request

*Commit*

Branch

*Commit* Open Pull Request

Branch

Open Pull Request

Merge once OK

matt/featurex

*Commit*

Page 10: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Lowers barrier of entry for everyone

10

Page 11: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Pull  Requests and commercial software: strange acquaintances or comfy bedfellows?

11

Page 12: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

What’s the point? We don’t need PRs right? We have: › Closed source › Everyone with access to the repo › We are collocated › We have existing code review processes

12

Page 13: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Increase quality through code reviews

13

Page 14: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Increase quality by reducing technical debt

14

Page 15: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Increase quality by reducing build failures

15

Page 16: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Support new developers

16

Upskill juniors

Page 17: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Remote work / context switching

17

Page 18: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Easily separate changes

18

git  checkout  master  git  checkout  –b  bugz  git  commit  –am  “Fixing  bug”  git  push  origin  bugz  *Create Pull Request*

git  checkout  –b  featurew  git  commit  –am  “Added  feature  X”  git  commit  –am  “Refactored  y”  *Find bug*

git  checkout  featurew  *Continue work*

Page 19: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Reduce feedback cycles

19

Page 20: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Use OSS model to scale

20

Product A Core Team

Product B Core Team

Product A Codebase

Product B Codebase

Pull Request

Page 21: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

The most effective change I’ve introduced that has improved code quality!

21

Page 22: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

It can’t be a silver bullet right? … right?

22

Page 23: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Bikeshedding

23

Page 24: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

“Just because you are capable of building a bikeshed does

not mean you should stop others from building one just

because you do not like the color they plan to paint it … you

need not argue about every little feature just because you

know enough to do so … the amount of noise generated by

a change is inversely proportional to the complexity of the

change.”

24

Poul-Henning Kamp, 1999

Page 25: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Balancing pickiness

› Particularly picky people might be avoided

› Minor changes stop important work getting merged

25

Page 26: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Less efficient communication

26

Page 27: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Lack of respect

27

code smell

awful rubbish

bad practice

smelly

why would you do that? irresponsible

Page 28: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Lack of cohesion › No core team › Lot’s of conflicts › PRs might get merged with little inspection › Devs might merge their own PRs › Competing priorities: ignoring review comments

28

Page 29: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Big PRs › Longer to get up › Harder to review › More likely to be wrong › Harder to integrate

29

Page 30: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page Page 30

Bad diff UIs

Page 31: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

There are things to be wary of, but

in general they can be dealt with

and PRs often help visualise them

31

Page 32: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

You’ve got me convinced – what tips do you have?

32

Page 33: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Invest in the future › Commit hygiene › Retain metadata when merging › Keep PRs focussed › Good branch/PR name and PR description

33

Page 34: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

PR Hygeine › Small › Frequent › Delete remote branches when merged

34

Page 35: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Collaborate mindfully › Subscribe to notifications › Regularly review and merge PRs › Prefer one PR per person ›  Integrate early or via separate PR

35

Page 36: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Act as a team › Be nice › Avoid emotive phrases › Call out awesome work › Ask questions when you aren’t sure › Don’t interrupt people if your PR isn’t urgent › Discuss major work before raising a PR

36

Page 37: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Have fun!

37

Page 38: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page 38

Page 39: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page 39

Page 40: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page 40

Page 41: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

These tips will help make PRs work smoothly

41

Page 42: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

So what should I do when I go back to work on Thursday?

42

Page 43: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Getting started › Use Git J › Find someone that knows Git well ›  In the first couple of weeks have someone push hard to regularly review and merge PRs to get the team in a flow then after that let the team self organise into their own rhythm from there

› When there is inevitably pain from large PRs let it happen and then after the fact be retrospective

43

Page 44: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Tools › GitHub › GitHub Enterprise › Bitbucket › Stash › GitLab

44

› Build notifications – Stash and GitHub

› GitVersion – detect pull requests and version appropriately

Page 45: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Be respectful Have fun Keep PRs small

45

Page 46: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Questions?

Rob Moore Lead Consultant, Readify [email protected] @robdmoore

Page 47: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Further Reading ›  http://robdmoore.id.au/blog/2013/12/01/using-pull-requests-for-

commercialprivateproprietary-development/

›  https://help.github.com/articles/using-pull-requests

›  https://confluence.atlassian.com/display/BITBUCKET/Work+with+pull+requests

›  https://confluence.atlassian.com/display/STASH/Using+pull+requests+in+Stash

›  http://scottchacon.com/2011/08/31/github-flow.html

›  https://github.com/blog/1124-how-we-use-pull-requests-to-build-github

›  http://blog.codeship.io/2013/08/22/the-codeship-workflow-part-2-pull-requests-and-code-review.html

›  http://cesiumjs.org/2013/10/08/GitHub-Pull-Request-Workflows/ 47

Page 48: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

Pull  Requests and Mainline Development and Continuous Delivery oh my!?

48

Page 49: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

PRs and mainline development

49

Page 50: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

“PRs should represent a ‘set of changes you want to merge into master’ rather than ‘a complete feature ready to be integrated’. As such they are directly compatible with mainline development.”

50

Rob Moore, 2014

Page 51: Push better software with PullRequests · Push better software with PullRequests Rob Moore Lead Consultant, Readify rob.moore@readify.net @robdmoore

Page

PR as a CD pipeline step › PRs increase confidence › Build PRs to get even more confidence › Ensure reviewers are thinking about effect on prod

51