Code Review Basics
Code review is the practice of having other developers examine your changes before they're merged, usually through a GitHub pull request. It catches bugs, improves code quality, and shares knowledge across a team.
Good code review involves clear, respectful comments, focusing on the code rather than the person, and asking questions when something isn't clear instead of assuming the worst.
# On GitHub PR page:
# Click a line number to comment
# Use 'Request changes' or 'Approve'Giving good feedback
Comment on specific lines, explain the reasoning behind suggestions, distinguish between required changes and optional suggestions, and acknowledge good decisions too.
Responding to feedback
Treat review comments as helpful, not personal criticism. Reply to clarify decisions, make requested changes, and push new commits to update the same pull request.
git add app.js
git commit -m "Address review feedback: validate empty input"
git push[main 7f3c2ee] Address review feedback: validate empty inputCommits and pushes a fix in response to a reviewer's comment, updating the same pull request automatically.
git log --oneline -37f3c2ee Address review feedback: validate empty input
9c2e1aa Fix crash when cart is empty
a3f5c9e Add login validationShows the review-driven follow-up commit in the branch's history.
Key points
- Code review has other developers examine changes before merging.
- It catches bugs and spreads knowledge across the team.
- Feedback should focus on the code, not the person.
- Pushing new commits to the same branch updates an open pull request.
