When I'm working on a branch, I want to quickly jump to my "TODO" comments. This means
- I only want "TODO" comments that were added on my branch (ignore the ones in master)
- I want each match to show the file and line number.
I know two partial solutions:
git grep TODO has the right format (with grep.lineNumber set to true), but too many results.
git diff master... | grep TODO is a good set of results, but doesn't show file and line number.
Is there an option to tell
git diff to prefix each changed line with the filename and line number? (
--line-prefix looked promising but seems to take only a fixed string.)
Can I pass
--new-line-format=":%dn: %L" (diff - output line-numbers) through
For example, currently my search results look like this:
$ git diff master... | grep TODO + // TODO use a non-fatal assertion + // TODO use a non-fatal assertion +// TODO make this conditional too
But ideally I'd like this:
src/foo/abc.cpp:221:+ // TODO use a non-fatal assertion src/foo/xyz.cpp:934:+ // TODO use a non-fatal assertion src/foo/util/extra.h:49:+// TODO make this conditional too