1

I am relatively new to using Git and I was wondering if there was a nifty way to prevent git commit from running if it detects any //TODO statements in the changes that you are attempting to commit.

IntelliJ used to detect this for me when I did SVN commits, but I would like to know the best way to accomplish this on the command line.

thatidiotguy
  • 8,701
  • 13
  • 60
  • 105

1 Answers1

3

You want to write and install a pre-commit hook which looks for // TODO in changes and returns a non-zero exit status if it finds that string.

merlin2011
  • 71,677
  • 44
  • 195
  • 329
  • So I would have to put the hook in the directory of every project I work on? Is there a way to have it run no matter where I call git on my desktop? – thatidiotguy Jan 26 '18 at 20:11
  • 1
    @thatidiotguy, You want to look at [this question](https://stackoverflow.com/q/2293498/391161). – merlin2011 Jan 26 '18 at 20:12