I use TortoiseGit on Windows. Everytime I start a new commit, the following shall happen:
How can I do this?
It can be done using TortoiseGit hooks (not to be confused with git hooks):
Create a batch file with the following line (just copy and paste):
git diff --color=always | findstr "[32m+[m[32m" | findstr /c:" TODO" >> %2
In the TortoiseGit settings go to Hook Scripts
.
Add
.Enabled
.*
for all paths)Command Line To Execute
box.Ok
and close settings.What does the batch file do?
git diff --color=always
shows all changes with nice colors.
We use those colors in addition to the +
to identify added lines with the first findstr
command.
The second findstr
command looks for " TODO".
The /c:
parameter tells findstr
to interpret the space as part of the search pattern.