See TODOs in a Branch


Here's how to see all the TODOs introduced in a branch.

See TODO contents

Two steps: Diff your PR branch compared to the master branch and then grep for TODOs. For instance:

git diff master..my-branch | rg TODO
-// TODO: use formatPrimaryErrorMessage in constructors
-// TODO: move errors into own module
-// TODO: use in message of GqlApiMutationError
-// TODO: use this for inline-save
-// TODO: use optionalProperties errors on all query schemas

It's simple, but it shows you all TODOs, even those you've removed, and now file names for where they're at. But, hey, the command is simple enough that you could type it from memory.

See file names and TODO contents

Want more? Here's a stinker. Only shows TODOs that you added in your branch, showing you all the tech debt you're about to introduce.

git --no-pager diff master..my-branch | awk '
/^diff --git/{file=substr($3,3)}
/^@@ /{line=$3}
/^\+.*TODO/{
    print file ":" substr(line,2);
    print $0;
}' | sort -u
src/app/projects/project/[projectId]/schedule/change-set.tsx:147,11
src/app/projects/project/[projectId]/schedule/edit-release-window-dialog.tsx:513,11
src/app/projects/project/[projectId]/schedule/schedule-tab-panel.tsx:40,25
src/app/projects/project/[projectId]/schedule/schedule-vm.ts:94,14
test/app/projects/project/[projectId]/content-tree-admin-api.ts:1,6
+ // TODO: use formatPrimaryErrorMessage in constructors
+ // TODO: move errors into own module
+ // TODO: use in message of GqlApiMutationError
+ // TODO: use this for inline-save
+ // TODO: use optionalProperties errors on all query schemas

That awk line does a lot. I think you'll want to throw this in a bash script. And if you do, the output's even better, interleaving file names and contents together.