How To Make A Pull Request Without Pulling Your Hair Out

Christine Belzie - Feb 19 '23 - - Dev Community

Grey background with the black-outlined GitHub icon. On the top right, there is pull request icon in black whereas on the middle left, you see "How To Make A Pull Request Without Pulling Your Hair Out" written in white and the tagline "Written by Chrissy Codes" written in black.

Welcome Back!!!

Congratulations! You've picked an open source project to contribute to and you're ready to start making a difference(Need a refresher? Check out this and that previous post.)! But before we can celebrate, you'll need to learn about one of the most essential tools in your open source contributor's toolkit: the pull request! So grab a snack and open that Google Doc (or whatever word-processing software you use), because

Willow Smith in a yellow hoodie and a dreadlocked ponytail says "Class is in season"

What the heck is a Pull Request?

Before I let you go and be "pull request happy", let's define what a pull request is. It's when you add your suggestion to an open source project via a line of code.

This is a multicolored diagram

Think of it as a software development version of putting your comments onto a shared Google Doc or presentation for a group project for school. It's essential in the open source contribution process because your line of code impacts how the project functions. Now that's settled, on to making your first pull request!

Movie countdown(e.g., 3, 2, 1)

Creating a Pull Request

Now there are so many methods to making a PR(these are the initials for pull requests), but here are steps that I find helpful.

  1. Fork the project's repository

A repository is about to be forked.

  1. Make your desired changes to the code or documentation

  2. Click on Commit Changes

  1. Add your message in the commit message textbox, pick the Create a new branch for this commit and start a pull request option, and click on Propose changes.

  1. Go to the projects repository and click on Compare & Pull Request

  1. Describe your changes in the pull request form, click on Create Pull Request , and wait for feedback from the projects maintainers

Congratulations, you're now a pull request pro! But before you start PR-bombing every open source project out there, let's cover some best practices to make sure your contributions are effective and appreciated by the project maintainers. So, let's dive into some essential PR dos and don'ts!

PR Dos and Donts

DOs:

  1. Use a descriptive title that summarizes your changes.

  2. Reference any relevant issue numbers in your pull request description.

  3. Add screenshots or other visual aids to help explain your changes (if applicable).

  4. Refer to the checklist shown on your pull request to ensure that you have completed all necessary steps.

DON'Ts:

  1. Don't make overly large or complex pull requests: it's better to break changes down into smaller, more manageable chunks.

  2. Don't make stylistic changes that are unrelated to the main purpose of the project.

  3. Don't disregard any code formatting or style guidelines set by the project maintainers.

  4. Don't forget to test your changes before submitting the pull request.

Conclusion

Congratulations, you're now a pull request pro, woohoo! Remember, making contributions to open source projects can be a fulfilling and rewarding experience. If you need a coding buddy or more inspiration, follow me on Hashnode and my other socials on Linkfree. May your contributions be bug-free and legendary.

Looney Tunes ending: "That's All Folks"

Credits

3 2 1 Waiting GIF by Funimation

GitHub Pull Request Diagram by Crunchify

Level Up Glu GIF by Ground Level Up

Willow Smith GIF by Red Table Talk

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .