GitHub & Projects
How to Review Your Own Pull Request Before Anyone Else Sees It
Nobody reviews your code as carefully as you can — if you do it before opening the pull request. A short self-review routine that catches the bugs, the stray files, and the confusing diffs that make reviewers stop trusting your work.
Every pull request is a first impression. A reviewer — a teammate, a maintainer, a teacher marking a lab — sees the size of the diff and decides within a minute how carefully to read it. A clean, focused one earns a careful review; a messy one earns a skim, a request for changes, or silence. The difference is rarely the code. It is whether anyone reviewed it before it was opened — and the person best placed to do that is you.
Your diff is not your code
The code on your screen is not what the reviewer sees. They see a diff: added lines, removed lines, a little context. A change that looks obvious in your editor can look baffling in a diff, because the reviewer cannot see the thinking behind it. Reviewing your own pull request means reading that diff like a stranger — line by line, without the memory of why each line is there.
The simplest version takes five minutes and catches a surprising amount. Open the pull request page, switch to the Files changed tab, and read the whole diff top to bottom before asking anyone to look. Do not skim, and do not skip the files you are confident about — that is where the mistakes hide: a debug print you meant to remove, a file edited by accident, a test commented out and forgotten.
Read the diff, not the files
Reading the final files is a poor substitute for reading the diff: the files do not show what changed, and what changed is what is being reviewed. The diff is the reviewer's view — make it yours too.
- Start with the file list. Any file you do not recognise is a red flag.
- Read in diff order. That is the order the reviewer meets the files — if the story does not make sense in that order, the pull request is harder to review.
- Read every added line out loud in your head. If you cannot explain one in a sentence, it needs a comment, or it does not belong.
- Check the removed lines too. Deletions are where regressions hide: a line that looked unused may be one the code quietly depended on.
Five checks that catch most problems
- Stray files. Build output, screenshots, editor settings, a database file, a .env meant to stay local — if a file is not part of the change, it does not belong in the pull request.
- Leftover debugging. Print statements, commented-out code, TODO notes meant for you, and test-only hacks that slipped into production code.
- Accidental scope creep. A pull request meant to fix one bug that now also refactors a helper and renames a variable elsewhere. Each is fine alone; together they make the review three times harder. Split them out.
- Naming and consistency. A variable named one thing in new code and another in old. A function doing something its name does not promise. An existing style, ignored by the new lines.
- The obvious question. For every change, ask what a reviewer would ask here. If you can already hear it, answer it now — in a comment, in the description, or by changing the code.
Check the story, not just the lines
A pull request tells a story: what was broken, what you changed, and why this change is the right one. The diff is the evidence; the title and description are the story. A reviewer reads the story first — if it does not match the evidence, they stop trusting both. Before opening it, read the title and description as if you had never seen the code.
Weak: Fix bug
Better: Fix login crash when the email field is empty
Weak: Changed some stuff in the auth module
Better: Validate empty email before calling the auth service,
so a blank login shows an error instead of a crash.A good description answers three questions: what changed, why it changed, and how it was tested. The testing part matters — it is the difference between a reviewer who can approve with confidence and one who must pull your branch and check it themselves. The same care belongs in the commits inside it: a commit message your future self can actually use is part of the same story.
Run it like a stranger will
Code that worked on your machine has not been proven to work anywhere else. Before opening the pull request, run the project the way a reviewer or an automated check would: from a clean checkout if you can, or at least after restarting the app and running the tests. That is where fresh-setup bugs show up — a missing import your editor quietly resolved, a config value that exists only locally, a test that passes only because of the order it ran in. Let automated checks run first: a green build lets the reviewer judge whether the change is right.
Leave comments for your reviewer — and your future self
Reviewers are not mind-readers, and neither is your future self. When a line needs context — a trade-off you considered, a strange-looking choice with a good reason — say so in a comment on the pull request. A short note saves a round of questions and shows the reviewer you thought about the change instead of just typing it.
Keep comments honest and short. "I tried the simpler approach first; it broke the case where the list is empty, so this version handles that" is worth more than a paragraph of justification. Do not use comments to apologise for the code — if you know a line is wrong, fix it before opening the pull request. A comment that says "I know this is hacky" is a confession, not a defence.
What a self-review will not catch
Self-review has a real limit: you cannot catch mistakes made from a wrong assumption. If you misunderstood the requirement, you will review your code against the same wrong understanding and find it correct. That is what other reviewers are for — self-review is a filter, not a replacement. It catches the careless mistakes and the confusing diffs, so the reviewer's time goes to what only a second person can see.
- Wrong assumptions about the requirement. Only a reviewer who read the task independently can spot these.
- Design choices you never questioned. The approach that felt natural to you may look unnatural to someone else.
- Blind spots from familiarity. You fill in gaps automatically; a reviewer who does not will trip over the ones you skipped.
Self-review matters most where you are least sure of the review you will get. On a first open-source contribution, the maintainer's first look at your diff decides whether they keep reading. The habits here are the same ones that make a first open-source contribution land well: small scope, clear story, nothing stray, nothing unexplained.
A fifteen-minute routine
- Check the file list. Remove anything that is not part of the change.
- Read the full diff, top to bottom, in the reviewer's order.
- Run the five checks. Stray files, leftover debugging, scope creep, naming, and the obvious question.
- Read the title and description as a stranger. Does the story match the evidence?
- Run the build and the tests from as clean a state as you can.
- Add the comments a reviewer will need — short, honest, only where the code cannot speak for itself.
- Open the pull request. Now it is ready for someone else's eyes.
The best reviewer of your pull request is you, five minutes before you open it. Read the diff like a stranger, and most of what a reviewer would flag never reaches them.
Reviewers remember the pull requests, not just the code
Over a semester of labs, a final-year project, or a string of open-source contributions, reviewers build an impression of you from your pull requests. Small, clean, well-described pull requests get faster, kinder reviews, because reviewers learn the work will be worth their time. The code matters, but the pull request is the package it arrives in — review it yourself first, and the package starts working for you instead of against you.