Skip to content

Instantly share code, notes, and snippets.

@abbasadel
Last active June 26, 2017 11:10
Show Gist options
  • Save abbasadel/1e4b75f97041e8827ca37b94ae411a5d to your computer and use it in GitHub Desktop.
Save abbasadel/1e4b75f97041e8827ca37b94ae411a5d to your computer and use it in GitHub Desktop.
Setup global git hook
#!/bin/sh
#create a folder to hold all global hooks
mkdir ~/.git-hooks
#download the hook that prepend branch name to the commit message
curl https://gist.githubusercontent.com/abbasadel/ff03536b35b36ce9953c6f6a879563e8/raw --output ~/.git-hooks/prepare-commit-msg
#make it executable
chmod +x ~/.git-hooks/prepare-commit-msg
#set the global hook config (git 2.9+)
git config --global core.hooksPath ~/.git-hooks/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment