Master GitHub Pull Request Example With Best Practices

Logan Jul 13, 2026

Collaboration is a cornerstone of modern software development, with GitHub's pull request feature being at the heart of this process. A pull request, or PR, allows team members to suggest changes to a branch within a repository, fostering discussion and feedback. Let's explore a comprehensive example to understand this crucial aspect of GitHub.

Incredible Pull Request Template Open Source Project
Incredible Pull Request Template Open Source Project

Imagine you're part of a team working on an open-source project, Django, a high-level Python web framework. You've decided to add a new feature - support for email notifications. Here's how you might go about this with a pull request.

Learn How to Contribute to Open Source
Learn How to Contribute to Open Source

Creating a Feature Branch

First, create a new branch for your feature. This keeps your changes separate from the main development branch, 'main'.

two screenshots with the same text on them, one showing an email message and the other saying'this is looking i've got a few comments that should be
two screenshots with the same text on them, one showing an email message and the other saying'this is looking i've got a few comments that should be

In your terminal, run:

git checkout -b email-notifications

Implementing the Feature

The 5 Most Popular Programming Languages - Stackify
The 5 Most Popular Programming Languages - Stackify

Now, implement the email notification functionality. Let's assume this involves creating a new file, 'notifications.py', and modifying 'settings.py'.

After committing these changes, your branch would look something like this:

  • notifications.py
  • settings.py (with your changes)
a diagram that shows the flow of people in a network, and how to use it
a diagram that shows the flow of people in a network, and how to use it

Creating the Pull Request

Once you're satisfied with your changes, it's time to create the pull request. Head over to the Django repository on GitHub and follow these steps:

  1. Click on the 'Pull requests' tab.
  2. Click on 'New pull request'.
  3. Under 'compare', enter 'email-notifications' in the first field, and 'main' in the second. This ensures you're requesting changes from your branch to 'main'.
  4. Add a title, such as 'Add email notifications', and a description detailing your changes. Click 'Create pull request'.
Practical example of using git in a school
Practical example of using git in a school

Reviewing and Approving Changes

Now, a PR summary page will open. This is where you and your team can discuss, review, and approve changes.

GitHub API: How to retrieve the combined pull request status from commit statuses, check runs, and GitHub Action results
GitHub API: How to retrieve the combined pull request status from commit statuses, check runs, and GitHub Action results
Introducing draft pull requests
Introducing draft pull requests
How to Add Screenshots and Animation to GitHub Pull Requests - Make Tech Easier
How to Add Screenshots and Animation to GitHub Pull Requests - Make Tech Easier
Quickly review changed functions in your Python pull requests
Quickly review changed functions in your Python pull requests
GitHub - cli/cli: GitHub’s official command line tool
GitHub - cli/cli: GitHub’s official command line tool
How to Open a Pull Request on GitHub
How to Open a Pull Request on GitHub
GitHub - tiimgreen/github-cheat-sheet: A list of cool features of Git and GitHub.
GitHub - tiimgreen/github-cheat-sheet: A list of cool features of Git and GitHub.
🔑 Git Key Commands & GitHub Key Features
🔑 Git Key Commands & GitHub Key Features
GitHub Explained for Product Managers - Department of Product
GitHub Explained for Product Managers - Department of Product
fix typo in serialization example by fmbenhassine · Pull Request #60 · javaee/jsonb-spec
fix typo in serialization example by fmbenhassine · Pull Request #60 · javaee/jsonb-spec
Create a Free Blog with Jekyll and GitHub Pages - [Step-by-Step Guide]
Create a Free Blog with Jekyll and GitHub Pages - [Step-by-Step Guide]
the ultimate guide to creating an in - app for your website
the ultimate guide to creating an in - app for your website
two screens showing different types of web pages
two screens showing different types of web pages
the differences between github and github in web design, which one should use?
the differences between github and github in web design, which one should use?
GitHub Copilot evolves from an 'AI assistant' to an 'AI development team,' revealing the full scope of its dedicated app.
GitHub Copilot evolves from an 'AI assistant' to an 'AI development team,' revealing the full scope of its dedicated app.
MNLLocationChoiceModelGroup by jiffyclub · Pull Request #33 · UDST/urbansim
MNLLocationChoiceModelGroup by jiffyclub · Pull Request #33 · UDST/urbansim
Embed GitHub User's All Repos on Website 🚀
Embed GitHub User's All Repos on Website 🚀
login form html css
login form html css
GitHub SonarQube workflow — .Net
GitHub SonarQube workflow — .Net
an image of a computer screen shot with the text editor highlighted in the bottom right corner
an image of a computer screen shot with the text editor highlighted in the bottom right corner

Let's say a core team member, Marc, reviews your PR. He suggests adding type hints to your new function. You can include this change in a commit message, append a comment, or even resolve the feedback by making the changes directly in your branch.

Addressing Feedback

To apply Marc's suggestion, you'd push a new commit to your 'email-notifications' branch. Once pushed, the PR would automatically update to include these changes.

Your team might follow a review process where each PR must have a certain number of approvals before being merged. Once approvals are gathered, a team member with appropriate permissions can merge the PR.

Merging the Pull Request

When merging, you can either 'Create a merge commit' or 'Rebase and merge'. The latter ensures a linear history in the 'main' branch. Choose your preferred method, then click 'Confirm merge'.

Congratulations! Your email notification feature is now part of the Django project. Continuously improving and adding features through pull requests is how open-source projects, and indeed, many commercial projects, thrive.