Hello fellow programmers!
Recently, I started learning Git, and pretty quickly discovered the amazing diff –check option, that doesn’t let those nasty stray whitespaces get in the commit. But those are ot the only things you’d like to exclude from the commit – there often are various debug statements in the code. So, what I’d like to know is whether there is any way of configuring git diff –check to watch after that?
Maybe I should use the similar functionality of Vim / emacs, and stop looking for options where they do not belong?
You may wish to investigate the Pre-commit hook which is the usual place to check for those sorts of errors. By using the pre-commit hook, Git will automatically check all commits without you having to remember to run
diff --check.