A Meritocracy of Pull Requests

A presentation at PHP Yorkshire in April 2019 in York, UK by Lorna Jane Mitchell

Slide 1

Slide 1

A Meritocracy of Pull Requests Lorna Mitchell, Nexmo

Slide 2

Slide 2

meritocracy noun plural -cies • rule by persons chosen not because of birth or wealth, but for their superior talents or intellect • the persons constituting such a group • a social system formed on such a basis https://www.dictionary.com/browse/meritocracy @lornajane

Slide 3

Slide 3

Who Opens a Pull Request? @lornajane

Slide 4

Slide 4

Who Reviews a Pull Request? @lornajane

Slide 5

Slide 5

Pull Request Outcomes @lornajane

Slide 6

Slide 6

CLOSE @lornajane

Slide 7

Slide 7

Small (pull request) Is Beautiful @lornajane

Slide 8

Slide 8

CLOSE @lornajane

Slide 9

Slide 9

MERGE @lornajane

Slide 10

Slide 10

Beware Merge Conflicts Option 1 : git merge —abort Option 2 : edit and add each file, then commit. @lornajane

Slide 11

Slide 11

Special Project Requirements You may be asked to: • Rebase your branch • Squash your branch into a single commit Both of these use git rebase but in really different ways! @lornajane

Slide 12

Slide 12

Rebasing @lornajane

Slide 13

Slide 13

Rebasing @lornajane

Slide 14

Slide 14

Rebasing 1. git 2. git 3. git 4. git 5. git checkout master pull checkout feature rebase master push -f <— use with extreme caution @lornajane

Slide 15

Slide 15

Squashing Uses “interactive rebase” - rewriting branch history. 1. git rebase -i [base commit] 2. Text file is ordered oldest to newest! 3. Edit, re-order or remove lines as desired 4. Instructions are in the file: f for fixup just adds this commit into the one before @lornajane

Slide 16

Slide 16

Commit Messages https://chris.beams.io/posts/git-commit/ @lornajane

Slide 17

Slide 17

REVIEW @lornajane

Slide 18

Slide 18

Do not view the diff @lornajane

Slide 19

Slide 19

REVIEW @lornajane

Slide 20

Slide 20

Do not view the diff @lornajane

Slide 21

Slide 21

REVIEW @lornajane

Slide 22

Slide 22

Do not view the diff @lornajane

Slide 23

Slide 23

REVIEW @lornajane

Slide 24

Slide 24

Language Matters You “review” a pull request. You don’t “merge” one. @lornajane

Slide 25

Slide 25

REVIEW @lornajane

Slide 26

Slide 26

Diff and DiffTool Tricks git diff master…HEAD <— everything on this branch, regardless what has happened on master since Configure your difftool and then replace diff with difftool in any command to get a graphical interface @lornajane

Slide 27

Slide 27

Automate All The Things @lornajane

Slide 28

Slide 28

The Art of Feedback @lornajane

Slide 29

Slide 29

If you didn’t run the code, you didn’t review the PR. @lornajane

Slide 30

Slide 30

OPEN @lornajane

Slide 31

Slide 31

Pull-Request Ready? Your project is pull-request ready if: • It has a README • There is a CONTRIBUTING.md file with expectations in • Build/tests run when a PR is opened • (optional) A pull request template outlines dependencies @lornajane

Slide 32

Slide 32

A Meritocracy of Pull Requests

Slide 33

Slide 33

Resources • https://joind.in/talk/b45a3 • https://gitworkbook.com • https://lornajane.net • https://github.com/matthewmccullough/scripts And, of course: http://octodex.github.com @lornajane