A pull request is how you propose changes to someone else's project on GitHub
A pull request is a message to a project owner that says: "I made changes on my copy of the code. Here they are. Would you like to merge them into the main project?" The project owner can review your changes, ask you to fix things, or accept them and merge them in. Pull requests are how most open-source projects work, and how teams coordinate changes without overwriting each other's work.
You create a pull request after you have pushed your changes to a branch on GitHub. The branch is your own copy of the project where you made edits. GitHub then compares your branch to the main branch and shows the differences. You write a title and description explaining what you changed and why, and the project owner gets a notification.
Key Takeaways
- You must create and push a branch before you can open a pull request — the pull request compares your branch to the main branch.
- GitHub shows you exactly what lines changed, added, or deleted between your branch and the main branch so the owner can review them.
- Your pull request title and description should explain what the changes do and why they matter, not just list the files you touched.
- The project owner may ask you to make more changes before they merge — you push new commits to the same branch and the pull request updates automatically.
- You can create a pull request even if your work is not finished, by marking it as a draft so the owner knows it is not ready to merge yet.
Push your branch to GitHub first
Before you can create a pull request, your branch must exist on GitHub, not just on your computer. If you have made changes on a branch called fix-login-bug, you push it to GitHub using the command line or GitHub Desktop. In the command line, you type git push origin fix-login-bug. In GitHub Desktop, you click "Publish branch" in the top right.
Once the branch is on GitHub, go to the repository page in your web browser. GitHub will usually show a banner at the top saying "Your recently pushed branches" with a button that says "Compare & pull request". Click that button and you skip straight to the pull request form. If you do not see the banner, click the "Branches" tab, find your branch in the list, and click "New pull request" next to it.
Write a title and description that explain what changed
GitHub opens a form with two text boxes: one for the title and one for the description. The title should be short and say what the change does. "Fix login bug" or "Add dark mode toggle" are good titles. "Update code" or "Changes" are not — they do not tell the owner what you actually did.
The description is where you explain why the change matters. If you fixed a bug, describe what was broken and how your fix solves it. If you added a feature, explain what it does and why someone would want it. If the change is related to an open issue, you can type "Fixes #42" (using the actual issue number) and GitHub will automatically close that issue when your pull request merges. The description can be as long as you need — use line breaks to keep it readable.
Review the diff before you submit
Below the title and description boxes, GitHub shows the diff — a line-by-line comparison of what changed. Green lines are additions. Red lines are deletions. Gray lines are context (unchanged code around your changes). Scroll through the diff and make sure it shows only the changes you intended. If you see changes you did not mean to make, go back to your branch, fix them, commit, push again, and the diff will update automatically.
The diff also shows you which files changed and how many lines were added or removed in each one. If your pull request touches 50 files and changes 2,000 lines, the owner will be less likely to review it quickly — smaller, focused pull requests are easier to understand and merge faster.
Choose which branch to merge into
At the top of the pull request form, you see two dropdowns: the base branch and the compare branch. The compare branch is your branch with the changes — GitHub fills this in automatically. The base branch is where your changes will go if the owner merges them. In most projects, the base branch is main or master. Do not change it unless you have a specific reason to merge into a different branch.
Some projects have multiple base branches for different versions or purposes. If you are not sure which one to use, check the project's README or contributing guide. The repository page usually links to these documents.
Submit the pull request and respond to feedback
Once your title, description, and diff look correct, click the "Create pull request" button. GitHub sends a notification to the project owner and anyone else watching the repository. Your pull request now appears in the "Pull requests" tab of the repository.
The owner may leave comments on specific lines of your code, asking you to change something or explaining why they cannot merge it. You do not need to create a new pull request — you just push new commits to the same branch. GitHub automatically updates the pull request to show the new changes. Keep pushing and responding to feedback until the owner approves and merges your pull request, or until they close it without merging.
Mark your pull request as a draft if it is not ready yet
Sometimes you want to open a pull request early to get feedback while you are still working, or to let the owner know you are working on something. You can mark the pull request as a draft so the owner knows it is not ready to merge. Click "Convert to draft" in the pull request page (it appears in the right sidebar). The owner will see a "Draft" label and will not merge it until you click "Ready for review".
Drafts are useful for big changes where you want feedback before you finish, or when you are not sure if your approach is right. The owner can comment and suggest changes while you keep working, and you convert it to a ready pull request once you have addressed the feedback.
Frequently Asked Questions
What if I made a mistake in my pull request and want to change it?
Push a new commit to the same branch. GitHub updates the pull request automatically to show the new changes. You do not need to close and reopen it. If you made a mistake in the title or description, click the three dots in the top right of the pull request and select "Edit".
Can I create a pull request if I do not own the repository?
Yes. If you forked someone else's repository, you can push a branch to your fork and create a pull request to the original repository. The owner will see your pull request and can review and merge it. This is how most open-source contributions work.
What does it mean if my pull request shows a red X or a green checkmark?
The X or checkmark is a status check — usually an automated test that runs on your code. A green checkmark means the tests passed. A red X means something failed. The owner may not merge your pull request until the checks pass. Click the X or checkmark to see what failed and fix it in your branch.
How long does it take for a pull request to be merged?
It depends on the project and the owner. Some owners review pull requests within hours. Others take days or weeks. Smaller, focused pull requests with clear descriptions usually get reviewed faster. If you have not heard back in a week, you can leave a polite comment asking for feedback.
Can I delete my branch after the pull request is merged?
Yes. GitHub usually offers a button to delete the branch right after the merge. You can also delete it manually from the Branches tab. Deleting the branch does not delete the pull request — the pull request stays in the repository's history.