A pre-commit hook for git that checks for the presence of DEBUG comments
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


What does this do?

This is a pre-commit hook you put in your git repo.

It allows you to write comments in your code like this:

// DEBUG: remove this log
console.log('some debug stuff: ', debug_val);

When you try to commit this file, it bitches at you, saying:

Please address the DEBUG comments in following files before committing:


Boom! You can't commit the file until you remove the DEBUG comment, which is a great reminder to not commit your debug code.


Simply put the file pre-commit.debug-comments into .git/hooks/pre-commit. You can also host this repo somewhere else and symlink .git/hooks/pre-commit to git-debug-hook/pre-commit.debug-comments.

That's it!

Supported languages

The hook detects language by file extension (ie, .js -> javascript, .lisp -> lisp, etc).

  • javascript
  • rust
  • html
  • lisp
  • (ba)sh
  • handlebars


If you want support for a certain language, don't open an issue, I'll probably just ignore it (being realistic here).

Fork the project and open a pull request. Be sure to also add your language to the supported language list or I'll contact the authorities. GOOD DAY, SIR/MADAM/NON-GENDER-CONFORMING-FORMAL-TITLE.


MIT. Yay.