Pull Requests and Code Review
What is a Pull Request (PR)?
A Pull Request is a proposal to merge your changes into another branch. It's the standard way teams review and discuss code before it goes live.
The PR Workflow
1. Create a branch → git switch -c feature/add-search
- Make changes → (edit files)
- Commit → git add . && git commit -m "Add search"
- Push to GitHub → git push origin feature/add-search
- Open a PR → (on GitHub website)
- Team reviews → (comments, suggestions)
- Make requested changes → (more commits)
- Merge → (click Merge on GitHub)
Anatomy of a Good PR
Title
Clear, descriptive:- ✅ "Add search functionality to navigation bar"
- ❌ "fix stuff"
Description
Explain:- What you changed
- Why you changed it
- How to test it
- Screenshots if it's visual
Example PR Description
## What
Added a search bar to the top navigation.Why
Users requested a way to search directly from any page (Issue #42).How to Test
- Click the search icon in the nav bar
- Type a search query
- Results should appear in a dropdown
Screenshots
[before/after screenshots]
Code Review Best Practices
As a Reviewer
- Be constructive, not critical
- Explain why something should change
- Approve when it's good enough, not perfect
- Use suggestions for small fixes
As an Author
- Keep PRs small (under 400 lines ideally)
- Respond to every comment
- Don't take feedback personally
Summary
| Step | Action |
|---|---|
| Branch | Create feature branch |
| Commit | Make small, focused commits |
| Push | Upload to GitHub |
| PR | Open with clear title & description |
| Review | Team reviews and approves |
| Merge | Combine into main |