Last active
August 29, 2015 14:19
-
-
Save brycepj/159255284dfd84fdb701 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LINE=$(head -n 1 $1); | |
LENGTH=${#LINE}; | |
if [[ $LENGTH -gt 50 ]]; then { | |
echo "Commit Aborted!"; | |
echo -e "Message is \e[31m$LENGTH characters long\e[0m, must be <= 50." | |
exit 1; | |
} fi; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir ~/.config/git | |
$ cp -r /usr/share/git-core/templates ~/.config/git/ | |
$ git config --global init.templatedir ~/.config/git/templates/ | |
$ wget https://gist.githubusercontent.com/CodeMan99/1ed7cc187f0e1c0a63bb/raw/9a50d3ae525d05eef1f083e6b87924d1a6ae1ec3/commit-msg | |
$ chmod 0755 commit-msg | |
$ mv commit-msg ~/.config/git/templates/hooks/ | |
$ git init # do this in any repo where you want to add the new git hook. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment