Pull Request

Development
Pull Request thumbnail

What is a pull request?

Definition:

A pull request (PR)is a way for developers to collaborate and propose changes in the codebase, doing so through the approval of another developer. This ensures that all changes are carefully reviewed and tested before being integrated into the codebase. You can think of a pull request as a peer review.

Analogy:

A pull request is like a chef preparing a meal and having their sous chef taste it before being served.

A chef will prepare ingredients and begin to cook a meal, starting with the basic foundation and slowly putting the entire meal together itself. The chef may first start off with working on the sauce. As they prepare the sauce, they will personally taste it as they make it to ensure they are on the right track. Once they think its in a good spot, they will then ask a sous chef or colleague to taste it, to ensure they get a second opinion before sending it out for a customer to eat.

If the sous chef has feedback, the chef will then be able to incorporate that feedback into their preparations, making alterations to the recipe to enhance the quality of the sauce. Once it is back to a place where the chef is confident with it, they will have the sous chef taste it again. When the sous chef gives the thumbs up, they will then use it as the final product for the meal.

In other words:

A pull request is a way for developers to collaborate on a codebase, ensuring that they review each other's work to only integrate code that is of quality and mutually agreed upon. Common code repositories like GitHub, GitLab, and Bitbucket leverage pull requests.

Why is a pull request important?

It's one thing to know what a PR is, but that is worthless if you don't know why you should know what a code repository in the first place. Let's break down the importance of this tech term based on two high level categories. We'll walk through an explanation as well as provide a score, 1-10, that shows you how much you should care about a pull request.

Pre-Product: 1/10

The first will be if you do not have a product yet. This means that you don't have a physical product. Maybe you're in the ideation phase, or maybe you're almost ready to start development. Whichever it is, we'll get into why a pull request is important and why you should or shouldn't care about it if you do not have a product.

If you don't have a product yet, you should not worry too much about what a pull request is, unless you are in the process of building your product. If you're pre-product though, don't worry about the proper developer habits that should be followed as you should be focusing on customer discovery and problem validation.

Live-Product: 8/10

The second category is if you do have a live product. Maybe you just launched your business or maybe it's been live for years and you're continuing to improve its quality. Regardless of the scenario, if your product is live, a PR carries a different weight.

If you do have a product, you absolutely should know what a pull request is and ensure that your development team is leveraging them. A pull request is your quickest way to mitigate development fires down the line, so it is critical that your team values pull requests and incorporates them into your development process.

Examples of pull requests

So you know what a pull request is, by definition. You know if you should care about it or not depending on your situation as a business/company/product. To dig in deeper, we will walk through some tools and processes so we can make sure you really have a solid grasp on a pull request.

Let's walk through three different examples where a developer may leverage a pull request:

  1. Bug fixing: If a developer is working through resolving a bug, they can open a pull request that addresses the specific bug in the codebase. The pull request will include proposed changes to the code, along with commenting/documentation, that should resolve the bug. The developer reviewing the pull request can then validate it before integrating the code.
  2. Refactoring code: If you need to refactor your codebase (improve it), then a developer can open a pull request when they are ready to merge the new and improved code. The pull request will include the improved codebase, which should have stronger architecture, readability, and maintainability of the code itself. The developer reviewing the code can validate that this refactored code is in fact more efficient and then merge the PR once approved.
  3. Building features: When you want to integrate new features into your codebase, a developer should open up a pull request before merging the new feature into the code base. Along with proper documentation, other developers can review the PR to ensure that the code will integrate properly.

Key Takeaways:

  1. A pull request is a way for developers to collaborate on a codebase and ensure that the code being pushed has been double checked before being merged.
  2. If you don't have a product, don't worry yet about pull requests.
  3. If you do have a product, you should be sure that your development team is leveraging pull requests to keep things efficient and clean.
  4. The three most popular code repos all have a pull request feature: GitHub, GitLab, and Bitbucket.
Not seeing a term? 🤔