Github Pull Request template (with examples)
How To Add a Pull Request Template on Github
Feel free to use one of the Pull Request template examples (simple-template, detailed-clean-template, detailed-verbose-template, detailed-with-type-template) and follow the official instructions on Github creating a Pull Request template for your repository. Luckily, you don’t need access to repository settings to add a Github Pull Request template.
Why Do You Need a Github Pull Request Template?
You probably do not need one if you are a single developer. In all other cases, even if you are working in a small team, I would say that having a Github Pull Request template will simplify the code reviewing process of a Pull Request. If a developer submitting a Pull Request took care and filled in the Github Pull Request template you might not even need to switch to that Pull Request’s branch at all.
Let’s imagine that a project does not have a Pull Request template and you have to review the following Pull Request on Github:
Does it answer any of your qustions as a reviewer? Did the developer submitting the Pull Request test their code? What if it’s a UI change, does it look good?
What would you do to review it? Probably the steps would be:
- Try to find a task/issus that the Pull Request solves
- Switch to the Github Pull Request’s branch
- Test the code and see if it meets all requirements from task/issue
- Look at the code from the Pull Request in order to find mistakes, bugs or other bad things
- Verify that the code meets quality standards of your project
You will be lucky if you reached step 5 and all looks great. Time to celebrate! What if you had to stop at step 3 because you didn’t agree on a visual details of the Pull Request changes? Would’ve it helped if there was a demo screenshot in the Github Pull Request? Of course, that would’ve saved 5-10 minutes of your time. That was just one Pull Request. If you do daily code reviews it will be a big time saving if they follow the same style with description, screenshots.
Now let’s imagine that there was a Github Pull Request template added to the project. The very same Pull Request with a template (this one):
What is the difference? Did it get any better? I would say it did.
Let’s imagine that a Bob is a not very experienced developer or he just recently joined the team. He has a Pull Request to create.
Bob sees that there is a Pull Request template ahd follows it step by step, filling in required details. They are reminded to submit a screenshot and do a self-review which should help to eliminate typos and simple bugs. Without a Pull Request template Bob might not know what to write or he would use his own style and you will end up having inconsistent Github Pull Requests.
Then you, as a reviewer will have Pull Requests that follow the same style, probably have less typos and bugs. Who would not like that? If you do not agree with the design or how it looks (in case the PR changes UI) you could request changes without even switching to that Github Pull Request branch. Faster feedback is always a good thing.
Github Pull Request Template Examples
# Description <!-- Please include a summary of the change --> <!-- Any details that you think are important to review this PR? --> <!-- Are there other PRs related to this one? --> # Demo <!-- Add a screenshot or a video demonstration when possible -->
Detailed Clean Template
# Task # Description # Demo # How Has This Been Tested? # Checklist - [ ] I have performed a self-review of my own code - [ ] I have added tests to cover my changes
Detailed Verbose Template
# Task <!-- Please add link(s) to Jira task(s) related to this PR --> A link to a task in Jira or an issus on Github # Description <!-- Please include a summary of the change --> <!-- Any details that you think are important to review this PR? --> <!-- Are there other PRs related to this one? --> A summary of the change, anything else that will to review this PR # Demo <!-- Add a screenshot or a video demonstration when possible --> A few screenshots or a video # How Has This Been Tested? <!-- Please describe how you tested your changes --> A detailed explanation how the code was tested # Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> - [ ] I have performed a self-review of my own code - [ ] I have added tests to cover my changes
Detailed With Type Template
<!--- Please provide a general summary of your changes in the title above --> ## Pull request type <!-- Please try to limit your pull request to one type, submit multiple pull requests if needed --> Please check the type of change your PR introduces: - [ ] Bugfix - [ ] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior? <!-- Please describe the current behavior that you are modifying, or link to a relevant issue --> Issue Number: N/A ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR --> - - - ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change -->
It is amazing how such a simple thing as Github Pull Request template can do so much for the team. Having a PR template will help to have professional looking, consistent pull requests. Feel free to download one of the Pull Request template examples (simple, detailed-clean, detailed-verbose, detailed-with-type) and follow the official Github instructions add Pull Request template for your repository. It will help your team save time on code reviews, iterate faster, and probably make code reviewing a more pleasant experience.