I tend to spread TODO and FIXME comments all over my code when i need to get something done quickly or i'm doing some totally unrelated to the codeparts where i found the flaw to do or to fix. I used to call a `grep -rn TODO` time to time to see the backlog i managed to pile up for myself but as you can guess it's just happened accidentally.
To get a bit more organized, i added a simple post-commit hook to my local git template directory, which runs `grep` to list the TODO and the FIXME items at each commit, so when i just finished a task and commited it, i get the list of the potential tasks right away, before i got a chance to start something else.
If you want something similar, here is a brief turn-by-turn roadmap:
Create a dir for your post-commit hooks:
mkdir -p ~/.git-templates/hooks
Configure git to use it:
git config --global init.templatedir '~/.git-templates'
Create the post-commit hook itself:
with the content:
git grep -nI TODO
git grep -nI FIXME
Make it executable:
chmod +x ~/.git-templates/hooks/post-commit
Go into your existing project dir, and re-init the repo:
And at your next commit you will see the list of your TODO items in the codebase. Don't forget to register the ~/.git-templates/ dir to your config backup script/tool!Share on Twitter Share on Facebook