git – order commits introducing “TODO”s by date

微笑、不失礼 提交于 2019-12-07 07:05:38

问题


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.


回答1:


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'




回答2:


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

git log -S TODO


来源:https://stackoverflow.com/questions/25749547/git-order-commits-introducing-todos-by-date

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!