What is a Pull Request?
A pull request (PR) is a proposal to merge changes from one branch into another. It's the primary collaboration mechanism on GitHub.
- Propose changes for review before merging
- Discuss code changes with your team
- Run automated tests and checks
- Keep a record of what changed and why
- Require approvals before merging
Creating a Pull Request
Push your branch to GitHub, then create a PR through the GitHub website or CLI.
Example
# 1. Create and push a feature branch
git switch -c feature-auth
# ... make changes ...
git add .
git commit -m "Add authentication system"
git push -u origin feature-auth
# 2. Create PR via GitHub CLI
gh pr create --title "Add authentication" \
--body "Implements JWT-based auth with login/register"
# 3. View PR status
gh pr status
# 4. After approval, merge
gh pr merge --squash PR Best Practices
Good pull requests are easy to review and understand.
- Keep PRs small and focused on one thing
- Write a clear description of what changed and why
- Add screenshots for UI changes
- Reference related issues: 'Closes #42'
- Respond to review comments promptly
- Don't force-push after review has started
