I have a lot of lines with
# TODO Alter route (Tell git to ignore this)
@comment.destroy # TODO Alter this line. (Tell git to ignore from '# TODO' onwards.
You could use a 'clean' filter. It is run before a file is staged.
First, define the file types that you want to use the filter for, and put them in your
Then, adjust your config so that you tell git what the "removetodo" filter is supposed to do on clean:
git config filter.removetodo.clean "sed '/TODO/d'"
sed command taken from Delete lines in a text file that containing a specific string
Then, when you do a git add, git will silently remove every line containing the word TODO from your .rb files, without affecting your working area.
The downside is that you will loose all your TODO's if you accidentally merge in any changes that touch these files.