Myzles › Guides
How to list the TODOs you added on a branch before a PR
Todoscope works in VS Code, Cursor, Windsurf and VSCodium. VS Code Marketplace · Open VSX (Cursor, Windsurf, VSCodium).
Before you open a pull request it's worth checking which TODOs you're about to ship. Not the 400 that were already in the codebase, just the ones your branch adds. Git can tell you in one line. Here's that line, a version with file and line numbers, and the editor view I use now.
1. The one-liner
git diff -U0 main...HEAD | grep -E '^\+.*\b(TODO|FIXME|HACK)\b'
main...HEAD(three dots) compares your branch with the point where it split frommain, so changes other people merged intomaindon't show up.-U0drops the context lines, so only changed lines are left.- The grep keeps lines starting with
+(added) that contain a tag.
Replace main with origin/main, develop or whatever your PR targets. On Windows this runs in Git Bash; in PowerShell use git diff -U0 main...HEAD | Select-String '^\+.*\b(TODO|FIXME|HACK)\b'.
What it misses: it only covers committed work, and it doesn't tell you which file or line each TODO is on.
2. Add uncommitted work and file:line numbers
This version compares your working tree (committed or not) with the branch point and prints file:line: text for each added tag. I tested it on a throwaway repo with committed, uncommitted and new files:
git diff -U0 $(git merge-base main HEAD) | awk '
/^diff --git/ { h = 1 }
h && /^\+\+\+ / { f = substr($0, 7) }
/^@@/ { h = 0; split($3, a, /[+,]/); n = a[2]; next }
!h && /^\+/ { if (/TODO|FIXME|HACK|XXX|BUG/) print f ":" n ": " substr($0, 2); n++ }'
Output looks like this, and most terminals and editors make file:line clickable:
src/billing.py:42: # TODO(myles): handle refunds
web/cart.js:118: // FIXME: rounding on totals
Two limits to know about. Brand new files that aren't tracked yet don't appear until you git add them (the diff only covers files git knows about). And it's still a text match, so a string like "TODO" counts too.
To see the TODOs your branch resolved, run the one-liner with '^-.*\b(TODO|FIXME|HACK)\b' instead.
3. Put it in CI
To check every PR automatically in GitHub Actions, check out with full history and diff against the base branch:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
git diff -U0 origin/${{ github.base_ref }}...HEAD \
| grep -E '^\+.*\b(TODO|FIXME|HACK)\b' || echo "No new TODOs"
Drop the || echo part and invert the check if you want the job to fail when a PR adds TODOs.
4. See them in your editor
The commands work, but I wanted the list next to my code while fixing things, so I added a branch view to Todoscope, my VS Code extension. With Pro, the command Todoscope: Show TODOs Added Since Branch… filters the TODO tree to what you added compared with main (or any branch, tag or commit), including work you haven't committed, with author and age on each item. It can also write a PR summary of the TODOs a branch adds and resolves.
Todo Tree has an open feature request for this (issue #800). When I checked on 2026-11-17, I found no equivalent in Todo Tree's or TODO Highlight's store pages or open issues. Pro is $12 a year or $29 once, with a 7-day trial and no card. The rest of the extension is free.
Which to use
| One-liner | awk script | Todoscope Pro | |
|---|---|---|---|
| Uncommitted work | No | Yes (tracked files) | Yes |
| File and line | No | Yes | Yes, click to jump |
| Only real comments | No | No | Yes |
| Works in CI | Yes | Yes | JSON report for CI |
| Price | Free | Free | $12/yr or $29 once |
FAQ
What's the difference between main..HEAD and main...HEAD in git diff?
With three dots, git diff compares HEAD with the point where your branch split from main, so you only see your changes. With two dots it compares with the current tip of main, which also shows everything merged into main since you branched, reversed.
How do I include TODOs I haven't committed yet?
Run git diff against the merge base instead of using a range: git diff -U0 $(git merge-base main HEAD). That compares your working tree, including unstaged edits, with the branch point.
Can I see TODOs my branch removed?
Yes. Swap the filter to lines starting with a minus: grep -E '^-.*\b(TODO|FIXME)\b'. Moved TODOs show up as one removed and one added line.
Can I run this in CI?
Yes. In GitHub Actions, fetch the base branch (actions/checkout with fetch-depth: 0), then run the same command against origin/main and fail the job or post the output as a comment.