From 21da1ea002427c1637dada103ad4535d9270d483 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Sat, 21 Jul 2012 15:14:29 -0400 Subject: [PATCH] Setting up some git hooks --- bashrc | 4 ++++ git/hooks/post-commit | 5 +++++ git/{ => scripts}/git-delete-branch | 0 git/{ => scripts}/git-github-init | 0 setup.sh | 10 +++++++--- 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100755 git/hooks/post-commit rename git/{ => scripts}/git-delete-branch (100%) rename git/{ => scripts}/git-github-init (100%) diff --git a/bashrc b/bashrc index 6072eba..1e5b5f8 100755 --- a/bashrc +++ b/bashrc @@ -100,6 +100,7 @@ alias desktop="cd ~/Desktop" alias fm="free -m" # git +alias g="git" alias ga="git add" alias gaa="git add ." alias gb="git branch" @@ -158,3 +159,6 @@ else alias vd="vimdiff" alias vo="vim -O" fi + +# Add autocomplete to `g` alias +complete -o default -o nospace -F _git g diff --git a/git/hooks/post-commit b/git/hooks/post-commit new file mode 100755 index 0000000..092a7b2 --- /dev/null +++ b/git/hooks/post-commit @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby +file="~/.gitshots/#{Time.now.to_i}.jpg" +puts "Say Cheese!!~! ;)" +system "imagesnap -q #{file}" +exit 0 diff --git a/git/git-delete-branch b/git/scripts/git-delete-branch similarity index 100% rename from git/git-delete-branch rename to git/scripts/git-delete-branch diff --git a/git/git-github-init b/git/scripts/git-github-init similarity index 100% rename from git/git-github-init rename to git/scripts/git-github-init diff --git a/setup.sh b/setup.sh index 82ecd53..8cf89aa 100755 --- a/setup.sh +++ b/setup.sh @@ -9,11 +9,15 @@ then fi ln -s $PWD/gitconfig ~/.gitconfig +ln -s ~/Dropbox/Pictures/Git\ Shots ~/.gitshots + +# Installs my git hooks +sudo ln -s $PWD/git/hooks/post-commit /usr/local/share/git-core/templates/hooks/post-commit if [ `uname` == 'Darwin' ]; then # TODO Installs Homebew - brew install git ssh-copy-id bash-completion macvim multitail nmap tmux wget htop mysql memcached + brew install git ssh-copy-id bash-completion macvim multitail nmap wget htop mysql memcached imagesnap # TODO Installs Server stuff (nginx, php53, pear, redis, memcached, what have you) # Clears out the old .bash_profile @@ -24,7 +28,7 @@ then # Adds paths and custom .bashrc echo " -export PATH=\"$PWD/git:$PATH\" +export PATH=\"$PWD/git/scripts:$PATH\" if [ -f $PWD/bashrc ] && ! shopt -oq posix; then @@ -81,7 +85,7 @@ else # Adds paths and custom .bashrc echo " -export PATH=\"$PWD/git:$PATH\" +export PATH=\"$PWD/git/scripts:$PATH\" if [ -f $PWD/bashrc ] && ! shopt -oq posix; then . $PWD/bashrc