So you’re a novice software developer that wants to know what a PR, or Pull Request, is in software development? A pull request can be a bit tricky to understand, especially if you don’t have a good understanding of how teams create code together.
The good news is that we are going to explain exactly what a Pull Request is, why we use them and how to do one! So you will no longer be confused by what a PR is in software development.
So without further ado, let’s jump right into what a pull request is.
What Is A Pull Request [PR] in Software Development?
In software development, PR stands for Pull Request. Simply put, a pull request is a request that you send in order to make changes to a current codebase. Pull requests are created with versioning tools like git and generally involve a repository like GitHub, GitLab, Bitbucket or Azure DevOps.
What Is Included In A Pull Request?
A pull request will always contain code changes of some sort. These are usually changes made in the form of a new feature, bug fixes, or improvements to the codebase. In addition, the Pull Request will have a title, a description, a list of reviewers, and the origin and target branch.
Pull Requests And Code Reviews
Pull Requests in software development are always associated with something called a code review. This is where other members of your team, or contributors to a project, review your code. These reviewers are then given the opportunity to approve the pull request and allow you to merge your code, deny your request, or comment on it.
That’s really all a pull request is!
If you don’t understand some of the topics I touched on like branches, merging or code reviews, it means you need to learn git! Going over all the features of git is way beyond the scope of this article, but it is an absolutely crucial tool if you want to become a web developer.
Pull Request [pr] Example
Here is a quick snapshot of what creating a pr in software development looks like. As you can see we have a bit of general information:
- Base Branch: ‘master’
- Current Branch: ‘SCSS-Refactor’
- Title: ‘Home-SCSS-Refactor’
- Description: ‘- refactored _home.scss to reduce code bloat‘
Underneath this general information section, we can see the actual code changes made and which files are affected.
All of this information will be available in the pull request. My other team members can see all the general information mentioned above and the code changes above. The red signifies code removed and the green signifies code added. Note that no code has been added here I just removed the .articles-promotions scss class.
Why Do We Use Pull Requests?
Pull Requests are incredibly important aspects of the development process while working in teams. Below I am going to outline some of the most important reasons we use PRs in web development.
1. Code Quality
The main reason we write PRs is that they tend to substantially increase the quality of code going into our codebases. When you spend many hours coding, it can be easy to make small mistakes or even miss big-picture ideas. Pull Requests give your team an opportunity to share insights, or request that you fix part of your code.
Maybe you wrote a function or method that has already been written, or maybe you just have a typo somewhere. Whether the error is big or small, it is always good to have an extra few sets of eyes on your code.
Writing PRs also adds a layer of accountability when coding in teams. As developers, we are all a little bit guilty of writing lazy code every now and then to get things to work and simply move on to the next challenge.
However, when you know that other members of your team are going to look at and judge your code, you tend to put a bit more effort into your code.
In an ideal world, you should always be writing the best possible code you can. With Pull Requests, you make that ideal world a bit more of a reality.
3. Learning Opportunity
In addition to the points above, PRs are also generally looked at as learning opportunities. When someone points out that you made a mistake in your code, it’s a lesson moving forward. Resulting in a cheap and effective way for companies to improve the skillset of their developers.
This works to help developers learn the ‘company way’ of doing things. While also learning ways to use languages and technologies more efficiently.
4. Updating The Team
Finally, Pull Requests in development teams are a great way to keep everyone on the team up to date on the changes being made within the codebase. Sometimes Pull Requests look fine and no changes are needed. However, that doesn’t mean it isn’t helpful for you to know when these changes take effect.
There have been countless times I have seen a PR come in during my job as a software developer and I later use the code changes to my advantage. Whether that means re-using a helper function that was previously created or knowing where a new strange bug probably originated.
Hopefully, you now understand that a PR, or Pull Request, is simply a request to make changes to a specific codebase. It is a very common and important part of every software development process. Pull Requests ensure you’re writing quality code, are accountable for the code you write, act as a learning opportunity, and keep everyone in the loop about new code changes.
If you are still unsure what a PR is in software development, check out this course on git. It will definitely help clear up any confusion.
As always, good luck and happy coding!