Last active
August 29, 2015 14:10
-
-
Save skyebook/5bdcaab9546b3432fcb5 to your computer and use it in GitHub Desktop.
push-defense
This file contains 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 | |
gitResult=$(git --version | grep 'git version 2.') | |
if [ -n "$gitResult" ]; then | |
# Don't push to any remotes unless a remote branch is specified | |
git config --global push.default nothing | |
mkdir -p ~/bin/git-hooks/hooks | |
curl https://raw.githubusercontent.com/bigbinary/tiny_scripts/master/git-hooks/hooks/pre-push > ~/bin/git-hooks/hooks/pre-push | |
chmod a+x ~/bin/git-hooks/hooks/pre-push | |
git config --global init.templatedir "${HOME}/bin/git-hooks" | |
else | |
# Need to update to git 2.x | |
echo "This tool requires at least git 2 to run. Your git version is $(git --version)" | |
fi |
timonus
commented
Dec 3, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment