diff --git a/INSTALL.sh b/INSTALL.sh index 6e7ed4f..652adb0 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -15,6 +15,7 @@ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/mas rm -rf ~/.bash_aliases rm -rf ~/.gitconfig rm -rf ~/.gitignore +rm -rf ~/.git_template rm -rf ~/.hushlogin rm -rf ~/.vim rm -rf ~/.vimrc @@ -25,6 +26,7 @@ rm -rf ~/.pythonstartup.py ln -s $(pwd)/bash_aliases ~/.bash_aliases ln -s $(pwd)/gitconfig ~/.gitconfig ln -s $(pwd)/gitignore ~/.gitignore +ln -s $(pwd)/git_template ~/.git_template ln -s $(pwd)/hushlogin ~/.hushlogin ln -s $(pwd)/vim ~/.vim ln -s $(pwd)/vimrc ~/.vimrc diff --git a/git_template/hooks/post-checkout b/git_template/hooks/post-checkout new file mode 100755 index 0000000..50a0859 --- /dev/null +++ b/git_template/hooks/post-checkout @@ -0,0 +1,4 @@ +#!/bin/bash +if [ -e bin/update_dependencies.sh ]; then + bin/update_dependencies.sh +fi diff --git a/git_template/hooks/post-merge b/git_template/hooks/post-merge new file mode 100755 index 0000000..50a0859 --- /dev/null +++ b/git_template/hooks/post-merge @@ -0,0 +1,4 @@ +#!/bin/bash +if [ -e bin/update_dependencies.sh ]; then + bin/update_dependencies.sh +fi diff --git a/git_template/hooks/pre-push b/git_template/hooks/pre-push new file mode 100755 index 0000000..2726a73 --- /dev/null +++ b/git_template/hooks/pre-push @@ -0,0 +1,17 @@ +#!/bin/bash + +protected_branch='master' +current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') + +if [ $protected_branch = $current_branch ] +then + read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty + echo + if echo $REPLY | grep -E '^[Yy]$' > /dev/null + then + exit 0 # push will execute + fi + exit 1 # push will not execute +else + exit 0 # push will execute +fi diff --git a/gitconfig b/gitconfig index 56db317..c349220 100644 --- a/gitconfig +++ b/gitconfig @@ -46,3 +46,5 @@ oldHighlight = red bold 52 newNormal = green bold newHighlight = green bold 22 +[init] + templatedir = ~/.git_template