Pre-commit is a python package that helps prevent wrong code getting into a commit. It automates the checking such that small bugs are caught early. It can also be customised!
The repository for githooks can be found here.
Give it a good scroll. Odds are you'll find something to your liking that will help keep your repositories cleaner (and potentially calmer).
Feedback? See an issue? Feel free to mention it here.
If you want to be kept up to date, consider getting the newsletter.