Before pushing a Git commit, I usually want to review all TODOs that I've added in the code. I've tried several approaches, but I'm still haven't found a good way to do this.
E.g. with the following command, I can see all TODOs added (and removed) in the last commit:
git diff HEAD^ | grep "TODO"
However in this output I don't see which files contained the change so I have to guess or search the corresponding files. With the following command, I see all files with a "TODO" change, but I don't see the actual TODOs:
git diff HEAD^ --name-only -G "TODO"
So my question is how can I both see the diff line and the name of the file containing the difference? Is it e.g. possible to make git diff
prefix every diff line with the file name? Then the grep'ed lines would give have all the information I need.