How to perform a code review in Git
· Category: Git
Short answer
Review code by examining the diff, testing locally if needed, and providing constructive feedback before approving.
Steps
- Read the PR description and linked tickets.
- Review the diff for logic, style, and security issues.
- Pull the branch locally if you need to test:
git fetch origin pull/123/head:pr-123
git checkout pr-123
- Leave comments and request changes or approve.
Tips
- Focus on correctness, readability, and maintainability.
- Use inline comments for specific lines.
- Automate style checks so reviewers can focus on logic.
Common issues
- Giant PRs are hard to review; request they be split.
- Nitpicking every minor style issue slows the team down; rely on linters instead.