Skip to main content

Stop using pull requests!

Yes, I know. A little bit of controversy in the title of this post could have triggered your attention. But hear me out.

I think that the pull request model is a good fit for open source development where people are working in their spare time on projects and want to design, collaborate and review in the open before accepting changes. I don't want to go in too much detail, so if you want to learn more about this model, check out the documentation on Github or the Atlassian BitBucket website.

Let me focus on the reason when and why I don’t like to use pull requests. I don’t think they are a good fit for dedicated software development teams working in close collaboration fulltime on the same codebase. In these teams I see pull requests used as a quality control mechanism allowing another (senior) developer to review the changes before approving them and pushing them to the master branch.

Pull requests are not a good fit for dedicated software development teams working in close collaboration fulltime on the same codebase.

After observing multiple teams using this approach, I noticed the following patterns:

  • It slows the team down. As work is waiting to be reviewed, context switching is necessary when feedback finally arrives. Especially when a more senior person needs to review the code, this person becomes the bottleneck slowing down the whole team. It wasn’t exceptional to see pull request remaining unreviewed for multiple days. This makes merge conflicts much more likely.
  • It leads us further and further away from continuous integration. To avoid the bottleneck, developers tend to work longer and longer on their feature branches postponing creating pull requests until their feature is completely ‘done’. As  a consequence pull requests become larger and larger. I’ve seen pull requests that impacted 50+ files.
  • The quality of the codebase decreases over time. This is quite contrary to what you would expect but unfortunately this is what I observed monitoring the work of multiple teams. Let me explain why this happens; it is all related to the previous observation. When pull requests get larger, it becomes a lot harder to review them. No one likes to read through hundreds of lines of code or is able to fully understand and grab the impact of a change spanning tens of files and classes. As a result the reviewers become more sloppy and will approve a pull request sooner (especially when the pull request is open for a few days, a long list of other PR’s are waiting to be reviewed, the business wants this feature yesterday and the person doing the review is the bottleneck from my first observation.)

Instead of using pull requests I would suggest to use trunk-based development together with pairing or mobbing to eliminate the need for code review. If you want to keep code reviews, you can conduct code reviews after integrating, rather than as a pre-integration gate. Let the team work in a continuous integration fashion integrating many times per day directly on the trunk (or master).

I noticed that using this approach has a positive impact not only on speed but also on code quality as we want to have the master branch in a releasable state.

Popular posts from this blog

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.

Podman– Command execution failed with exit code 125

After updating WSL on one of the developer machines, Podman failed to work. When we took a look through Podman Desktop, we noticed that Podman had stopped running and returned the following error message: Error: Command execution failed with exit code 125 Here are the steps we tried to fix the issue: We started by running podman info to get some extra details on what could be wrong: >podman info OS: windows/amd64 provider: wsl version: 5.3.1 Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:2655: connectex: No connection could be made because the target machine actively refused it. That makes sense as the podman VM was not running. Let’s check the VM: >podman machine list NAME         ...

Cleaner switch expressions with pattern matching in C#

Ever find yourself mapping multiple string values to the same result? Being a C# developer for a long time, I sometimes forget that the C# has evolved so I still dare to chain case labels or reach for a dictionary. Of course with pattern matching this is no longer necessary. With pattern matching, you can express things inline, declaratively, and with zero repetition. A small example I was working on a small script that should invoke different actions depending on the environment. As our developers were using different variations for the same environment e.g.  "tst" alongside "test" , "prd" alongside "prod" .  We asked to streamline this a long time ago, but as these things happen, we still see variations in the wild. This brought me to the following code that is a perfect example for pattern matching: The or keyword here is a logical pattern combinator , not a boolean operator. It matches if either of the specified pattern...