A pull request (PR) is a way to propose merging changes from one branch into another in a GitHub repository. PRs allow for team-based code review and collaboration before changes are integrated into the main branch.
What is a Pull Request? 📝
A PR is a formal request to merge changes from one branch (source) into another (target).
It enables team members to review, discuss, and approve changes before merging.
PRs show the difference between branches, making changes clear.
Where Can You Create a Pull Request? 🛠️
The article below demonstrates creating a PR using the GitHub terminal workflow.
Create Your First Pull Request ⚡
1. Clone Repo and Create a Branch 🔀
git clone <repo-url>
cd <repo-directory>
git checkout -b branch_name
Use a meaningful branch name that reflects your update.
2. Make and Commit Changes 🛠️
Edit files as needed in your editor.
Stage and commit
git add .
git commit -m "commit details"
Check status
git status
Ensure your changes are committed.
3. Push the Branch to GitHub ⬆️
git push origin branch_name
Push your branch to the remote repository.
4. Open PR in GitHub UI 🌐
Go to your repository page on GitHub.com.
You’ll see a “Compare & pull request” button for your branch—click it.
Example
![Git 15]()
5. Fill Out Pull Request Details 📝
Select the correct base (target) and compare (your feature) branches.
Add a clear title and description of the changes.
Example
![Git 17]()
6. Submit for Review 👀
Click “Create pull request”.
Team members are invited to review your PR.
Example
![Git 18]()
7. Merge Once Approved ✅
When approved, merge your PR to finalize the changes into the main branch.
![Git 19]()
Best Practices for PRs 🏆
Keep PRs Small: Small changes are easier and faster to review and introduce fewer bugs. ✂️
Self-review Before Submitting: Test and check your PR before requesting review. 🕵️
Provide Context: Write clear titles and detailed descriptions so reviewers understand the change. 🏷️
Conclusion
Effective use of pull requests is key to collaborative software development. By creating focused, well-documented PRs, you enable your team to review code efficiently, maintain high quality, and streamline integration into the main branch. Keeping PRs small, performing self-reviews, and providing clear context and descriptions reduces review time and the likelihood of bugs.
Using meaningful branch names and committing regularly with descriptive messages enhances traceability. Once your PR is approved, merging it finalizes the update and progresses the project. Mastering this workflow ultimately fosters better teamwork and smoother project delivery on GitHub.