| id | create-a-pull-request | |||||||
|---|---|---|---|---|---|---|---|---|
| title | Create a Pull Request | |||||||
| sidebar_label | Create a Pull Request | |||||||
| sidebar_position | 9 | |||||||
| description | Learn how to create a pull request (PR) on GitHub to propose changes, collaborate with others, and contribute to open-source projects. | |||||||
| tags |
|
|||||||
| keywords |
|
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.
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.
:::tip Think of a pull request as saying
Hey, I’ve made some improvements. Can you check and merge them?
:::
Before you can open a pull request, make sure your branch is already pushed to GitHub.
git push origin feature/add-readmeOpen 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.
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
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.
Scroll down to see all the files changed. Make sure your commits reflect what you actually want to merge — and nothing extra.
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
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
Once approved, the PR can be merged. If you have permission, click:
Merge Pull Request → Confirm Merge
After merging, delete your branch to keep the repository clean:
git branch -d feature/add-readme# 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- 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
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