5

I want to find commits that introduced added a "TODO" or "FIXME" comment and order them by date.

I know that git log -G'TODO|FIXME' will show me commits that contain either comment and I could do something like

git log --format='%ci' -G'TODO|FIXME' | cut -d' ' -f 1

But this will not respect that it should only be commits introducing such comments.

Does anyone know how I can find only commits introducing such comments and order them by date? If the actual SHA-1 was included in that list, that would be even more awesome.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Ingo Bürk
  • 19,263
  • 6
  • 66
  • 100
  • What do you mean by "introducing"? That these words have to be at the start of the commit message? –  Sep 09 '14 at 16:23
  • Sorry, no I meant that the commit *added* such a comment (opposed to a commit removing it or just changing a word in it) – Ingo Bürk Sep 09 '14 at 16:26

2 Answers2

5

This should get you closer. It isn't clear what you mean by "order them by date". Personally I would probably ignore the actual dates and do reverse topo order.

Note - This will match commits that introduce or remove instances of the string. If you only want commits that introduce you might need to script something.

git log --format='%H' --reverse --date-order -G'TODO|FIXME'

uday
  • 8,544
  • 4
  • 30
  • 54
Andrew C
  • 13,845
  • 6
  • 50
  • 57
0

not entirely what you want but will do a lot for you

git log -S TODO
Alexander Oh
  • 24,223
  • 14
  • 73
  • 76