Pull Request Flow with usethis

Choose your own adventure and get in the ‘usethis’ pull request flow with this flow chart.
Author

Garrick Aden-Buie

Published

October 7, 2021

Keywords

rstats

A flow chart for the pull request functions in the usethis R package.

A flow chart for the pull request functions in the usethis R package.

Introduction

The usethis package is full of incredibly helpful functions that make life as an R developer easier. A lot of the package’s functions target R package maintainers, but there’s a small cluster of functions that are life changing for anyone who uses git or collaborates with others via GitHub.

These pull request helpers all start with the pr_ prefix, but I initially found them a little confusing to use since they’re each designed to be called in a specific context — for example, when you have local work that isn’t associated with a PR or when a PR exists but you don’t have the work locally on your computer.

Once I wrapped my head around the functions, though, using them has utterly transformed my day-to-day workflow. I can move in and out of collaborative work seamlessly. The flow chart above is my personal mental model of this cluster of functions and I hope it helps you make sense of them, too.

There are other great resources available in the usethis documentation. Beyond the function documentation, there’s also the great Pull request helpers article. That article walks through a pull request from the perspective of a contributor and a package maintainer.

In this blog post, however, you get to play both roles and choose your own adventure!

Choose your own pull request adventure

Welcome to this choose-your-own-adventure blog post. It's a little bit unusual, but don't worry, I'll walk you through it.

Look for the Decision time: icon. It tells you that it’s time for you make a choice. But don’t worry, there’s no wrong choice: if you take a wrong turn you can always use your browser’s back button to retrace your steps.

Decision time: Ready to get started?

Start over

Download the usethis pr_*() flow chart

Creative Commons License Pull Request Flow with usethis by Garrick Aden-Buie is licensed under a Creative Commons Attribution 4.0 International License.

Footnotes

  1. I primarily use GitHub, but I think these functions will generally work for other code-hosting platforms as well, like GitLab or others.↩︎