Skip to content

Just some git hooks I made and use

License

Notifications You must be signed in to change notification settings

Eriner/githooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

githooks

Just some git hooks I use.

Not production ready, lots to do. I'll eventually get these to a point where I can recommend them to people, and as CI tools.

Purpose

These tools exist almost entirely to mitigate human error. I make mistakes, and these automations are safety-switches that future-me will thank present-me for.

There are occasions when I'll use $ git --no-verify, but I would like that to be the exception.

Ideally when these tools declare a failure, it means things are broken and need to be fixed - not that I should just override the verifications.

Use

Either run ./build.sh, or:

go install ./...
git config --global core.hooksPath ${PWD}/hooks

The hook scripts merely call the tools in this repository in sequence.

All tools are intended to be "smart" enough to know when they are and are not relevant. They're all written in Go, and currently without any external dependencies. These hooks can be installed easily on an air-gapped machine.

When invoked (when a tool deems itself "relevant" to the current commit) the tool will either exit with an error, halting the git operation, or will print an explicit "all clear" to indicate it has run but encountered no errors.

Tools

Some of these tools may be broken out into separate sub-tools in the future, ex: hook-go becomes hook-go, hook-go-security, hook-go-test, hook-go-mod, etc. Applying any sort of configuration to these tools is beyond their scope. Better to just enable/disable tools entirely.

pre-commit

commit-msg

post-commit

pre-push

About

Just some git hooks I made and use

Resources

License

Stars

Watchers

Forks