How to Create a Pull Request (PR) in GitHub: Step-by-Step Guide

In modern software development, collaboration is key—and pull requests (PRs) are the cornerstone of team workflows in GitHub. A pull request is how you propose changes, request feedback, and ultimately merge your contributions into a shared codebase.

In this blog, we’ll walk you through how to create a pull request on GitHub, along with best practices to ensure your PRs are clear, efficient, and effective.


🔧 What Is a Pull Request?

A pull request lets you notify others about changes you’ve pushed to a branch in a GitHub repository. You’re essentially saying: “Hey, I’ve made these changes—please review and merge them.”

It’s commonly used in:

  • Open source contributions
  • Team collaboration
  • Code review workflows

✅ Prerequisites

Before creating a PR, make sure you’ve:

  1. Forked the repo (for open source)
  2. Cloned the repo locally
  3. Created a new branch
  4. Committed and pushed your changes

📘 Example Git Workflow Before PR

# Create and switch to a new branch
git checkout -b feature/login-form

# Make changes, then add and commit
git add .
git commit -m "Add login form component"

# Push to GitHub
git push origin feature/login-form

🚀 How to Create a Pull Request on GitHub

📌 Step 1: Navigate to the Repository on GitHub

Go to your repository on GitHub (either your fork or the original repo).

📌 Step 2: Switch to the Branch You Pushed

Use the branch dropdown to switch to your feature branch (e.g., feature/login-form).

📌 Step 3: Click “Compare & pull request”

GitHub usually detects recently pushed branches and offers a “Compare & pull request” button.

If not:

  • Go to the “Pull requests” tab
  • Click “New pull request”
  • Choose:
    • Base branch: the branch you want to merge into (e.g., main)
    • Compare branch: your branch with changes

📌 Step 4: Fill in PR Details

  • Title: Clear and concise summary
  • Description: Explain what this PR does, why it’s needed, and any context
  • Mention relevant issues or teammates using #issue or @username

📌 Step 5: Submit the Pull Request

Click “Create pull request”.

Congrats—you’ve now submitted a PR!


🔍 Optional: Add Reviewers, Labels, and Assignees

After creating the PR, you can:

  • Assign reviewers to request feedback
  • Add labels like bug, feature, or needs review
  • Assign the PR to yourself or another team member

🔁 What Happens Next?

Once the PR is submitted:

  • Reviewers can leave comments, suggest changes, or approve it
  • You can push additional commits to the same branch, and they’ll update the PR
  • Once approved, you or a maintainer can merge the PR

🧠 Best Practices for Great PRs

  • ✅ Keep PRs small and focused
  • ✅ Use descriptive titles and summaries
  • ✅ Reference related issues
  • ✅ Make sure the code builds and passes tests
  • ✅ Include screenshots or test cases if relevant

🔚 Summary

StepAction
1. Push branchgit push origin feature/my-feature
2. Create PRUse “Compare & pull request” on GitHub
3. Fill out detailsAdd title, description, reviewers, etc.
4. Submit PRClick “Create pull request”
5. Follow upRespond to feedback and merge when ready
Sharing Is Caring:

Leave a Comment