Pull Requests
Propose, review, and merge changes on GitHub
Skills taught: github.pull-requests, github.code-review
Creating a Pull Request
# 1. Create and push a feature branch
git switch -c feature/user-profile
# ... make changes ...
git add .
git commit -m "Add user profile page"
git push -u origin feature/user-profile
# GitHub shows a banner: 'Compare & pull request'
# Click it, or use the GitHub CLI:
gh pr create \
--title "Add user profile page" \
--body "Closes #42. Adds profile page with avatar, bio, and stats." \
--reviewer teammate-username
# See your open PRs
gh pr list
# Check out a teammate's PR locally to test it
gh pr checkout 42
Writing a good PR description
## What changed
- Added `/profile` route with UserProfile component
- Avatar upload using existing S3 integration
- Bio field limited to 160 characters (Twitter-style)
## Why
Closes #42 — users requested the ability to customise their public profile.
## How to test
1. Log in, click your avatar → 'Edit profile'
2. Upload a photo — check it appears in the header
3. Edit bio, save — confirm it persists on reload
## Screenshots
[Attach before/after screenshots here]
## Checklist
- [x] Tests added
- [x] Mobile-responsive
- [x] Accessibility: form labels, ARIA
Reviewing a PR
# Check out the PR locally
gh pr checkout 42
# Run it, test it
npm run dev
# Leave a review via CLI
gh pr review 42 --approve --body "Looks great! Tested locally."
gh pr review 42 --request-changes --body "Please add error handling for network failure"
# After approval — merge
gh pr merge 42 --squash --delete-branch
# Options: --merge (merge commit), --squash (one commit), --rebase
Frequently Asked Questions
Should I squash, merge, or rebase merge a PR?
Squash (all PR commits → one commit on main) — clean history, best for most PRs. Merge commit (preserves all commits + adds a merge commit) — useful when branch history matters. Rebase and merge (replays each commit onto main linearly, no merge commit) — clean but rewrites hashes. Most teams pick one strategy and stick to it.
What does 'Closes #42' in a PR description do?
GitHub automatically links the PR to issue #42 and closes the issue when the PR is merged. Also works with: Fixes #42, Resolves #42.