Skip to content

Instantly share code, notes, and snippets.

@MitMaro
Created May 2, 2017 19:24
Show Gist options
  • Save MitMaro/a1d7c518d3954e7c27af5cadb55450e9 to your computer and use it in GitHub Desktop.
Save MitMaro/a1d7c518d3954e7c27af5cadb55450e9 to your computer and use it in GitHub Desktop.

Create a directory ~/.git-hooks/ and copy the commit-msg file into the directory.

Run: git config --global core.hooksPath /Users/<username>/.git-hooks/

You will need to copy the commit-msg file into .git/hooks/ of any existing repository.

All new repositories will automatically get the hook.

#!/bin/sh
# enable keyboard stdin
exec < /dev/tty
# strip comments
gsed -i 's/\#.*//' "$1"
# check commit message
aspell check "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment