I'd like to have a simple shell command to find my TODOs that are in the diff between my current branch and the repository's main branch.
On our team, we have an agreement, that we do not add new todos to the codebase, but we still have a couple of older todo items in our repository. However, when I work, I like to leave a todo in the code so that I don't forget to look into things or clean up things.
What I could already implement is showing the TODO
items in the diff using grep
. For example, if the main branch is called develop
(but honestly, it would work the same with main
, master
:
# command
git diff develop HEAD | grep TODO
# output
+ // TODO: How to handle when summary is missing?
+ // TODO: How to handle this error? Exception?
+ // TODO: add function to build basket, maybe?
+ // TODO: Find a better place to set up this mock
This is a good start, but it would be much better if the names of the files (that include these todos) were also printed. Another problem with my current approach is that if there is no message after the TODOs, I can't really search for that in my project (in case the code base has TODOs that were added before (and are part of the main branch)