Skip to main content

Create a Pull Request

Once you’ve made changes to your code and pushed them to GitHub, the next step is to create a Pull Request (PR). A Pull Request is how you propose your changes to be merged into another branch — typically the main branch.


It’s also where discussions, reviews, and collaboration happen before merging your work.

What is a Pull Request?

A Pull Request (PR) allows you to tell others about changes you’ve pushed to a branch in a GitHub repository. When you open a PR, you’re asking the repository maintainer to review your code and merge it into the main codebase.

Think of a pull request as saying
Hey, I’ve made some improvements. Can you check and merge them?

Step-by-Step: How to Create a Pull Request on GitHub

1. Push your branch to GitHub

Before you can open a pull request, make sure your branch is already pushed to GitHub.

git push origin feature/add-readme

2. Go to your repository on GitHub

Open your repository in your browser, e.g.:
https://github.com/<your-username>/<repository-name>

GitHub will often display a yellow bar like this:

Compare & pull request – You’ve recently pushed a branch.

Click on Compare & pull request.


3. Choose branches to compare

You’ll see two dropdowns:

  • base: usually main (where you want your changes to go)
  • compare: your feature branch (the one containing your new commits)

Example:

base: main ← compare: feature/add-readme

4. Write a clear pull request title and description

Add a meaningful title and a short description of your changes.

Example:

Title:
Added a detailed README with setup instructions

Description:

### What’s new
* Added a comprehensive README file
*-* Included setup, usage, and contribution guide

### Why
To help new contributors get started quickly.

This helps reviewers understand your contribution at a glance.

5. Review your changes

Scroll down to see all the files changed. Make sure your commits reflect what you actually want to merge — and nothing extra.

6. Create the Pull Request

Click on Create Pull Request 🎉 Your PR is now open!

It will appear under the repository’s Pull Requests tab, where reviewers can:

  • Comment on your changes
  • Suggest edits
  • Approve or request modifications

7. Review Process

Once you submit your PR:

  • Reviewers may leave comments asking for clarification or improvements
  • You can make more commits to your branch, and they’ll automatically appear in the same PR
  • When everything looks good, the maintainer will merge your PR into the base branch

8. Merge the Pull Request

Once approved, the PR can be merged. If you have permission, click:

Merge Pull RequestConfirm Merge

After merging, delete your branch to keep the repository clean:

git branch -d feature/add-readme

Example Workflow Summary

# Create a new branch
git checkout -b feature/add-readme

# Make changes
git add .
git commit -m "Added detailed README"

# Push to GitHub
git push origin feature/add-readme

# Open PR on GitHub website
# base: main ← compare: feature/add-readme

Best Practices for Pull Requests

  • Keep PRs small and focused — easier to review
  • Write clear titles and meaningful commit messages
  • Add screenshots if your change affects the UI
  • Reference related issues using Fixes #issue-number
  • Respond to review comments promptly

Summary

You’ve learned how to:

  • Understand what a Pull Request is
  • Create and open a PR on GitHub
  • Write a good title and description
  • Collaborate and merge your changes

Need help? Ask your questions or share your first PR experience in the GitHub Discussions. We’d love to hear from you and help you grow as a contributor