Sometimes you need to find a specific git commit.
Maybe you deleted some code you shouldn’t have. Maybe a feature that used to work suddenly doesn’t.
Now you’re going through commits, trying to guess which one you need based on commit messages

Pain.
When no rules are enforced, things default to chaos.
If you want a clean commit history with clear messages, you need two things
A clear commit message format
A way to enforce it automatically
And it’s actually quite easy to set up with Git hooks and a linter.
Git Hooks
A Git hook is a script that runs whenever a certain git event happens.
What are git events?
A typical git workflow looks like this:

Add, commit, push are the events.
These are a few common hooks:

Pre-commit runs before commit, pre-push runs before push, etc.
There are 14 client hooks in total.
If you log the .git/hooks folder, you will see all of them:

To use a hook, create a script with the same name.

Inside, you can run any script you want:
#!/bin/sh
#commit-msg
echo "Before commit, check the message"Now every time you do a “git commit -m”, git will log "Before commit, check the message."
Btw, commit message runs here:

Linting commit message
What we want is simple: every commit message should follow the same format.

To do that, use a tool like commitlint.
Install the required packages.
# install required packages
pnpm add -D @commitlint/cli @commitlint/config-conventional
# use default config
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.jsThen put this script inside the commit-msg file:

If the message doesn’t match your format?
The commit fails.
⚫️ input: Fixed. Yay
❌ subject may not be empty [subject-empty]
❌ type may not be empty [type-empty]Where Expertise Becomes a Real Business
Kajabi was built for people with earned expertise. Coaches, educators, practitioners, and creators who developed their wisdom through real work and real outcomes.
In a world drowning in AI-generated noise, trust is the new currency. Trust requires proof, credibility, and a system that amplifies your impact.
Kajabi Heroes have generated more than $10 billion in revenue. Not through gimmicks or hype, but through a unified platform designed to scale human expertise.
One place for your products, brand, audience, payments, and marketing. One system that helps you know what to do next.
Turn your experience into real income. Build a business with clarity and confidence.
Kajabi is where real experts grow.
Now you know how Git hooks works and the use case.
Fee from Anime Coders
PS: Git hooks only work locally. That’s why it’s not the best tool for collaboration. To solve this problem, developers often use it through a tool like Husky.


