Setting up some git hooks

This commit is contained in:
Josh Sherman 2012-07-21 15:14:29 -04:00
parent 5e79c185f5
commit 21da1ea002
5 changed files with 16 additions and 3 deletions

4
bashrc
View file

@ -100,6 +100,7 @@ alias desktop="cd ~/Desktop"
alias fm="free -m" alias fm="free -m"
# git # git
alias g="git"
alias ga="git add" alias ga="git add"
alias gaa="git add ." alias gaa="git add ."
alias gb="git branch" alias gb="git branch"
@ -158,3 +159,6 @@ else
alias vd="vimdiff" alias vd="vimdiff"
alias vo="vim -O" alias vo="vim -O"
fi fi
# Add autocomplete to `g` alias
complete -o default -o nospace -F _git g

5
git/hooks/post-commit Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
file="~/.gitshots/#{Time.now.to_i}.jpg"
puts "Say Cheese!!~! ;)"
system "imagesnap -q #{file}"
exit 0

View file

@ -9,11 +9,15 @@ then
fi fi
ln -s $PWD/gitconfig ~/.gitconfig 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' ]; if [ `uname` == 'Darwin' ];
then then
# TODO Installs Homebew # 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) # TODO Installs Server stuff (nginx, php53, pear, redis, memcached, what have you)
# Clears out the old .bash_profile # Clears out the old .bash_profile
@ -24,7 +28,7 @@ then
# Adds paths and custom .bashrc # Adds paths and custom .bashrc
echo " echo "
export PATH=\"$PWD/git:$PATH\" export PATH=\"$PWD/git/scripts:$PATH\"
if [ -f $PWD/bashrc ] && ! shopt -oq posix; if [ -f $PWD/bashrc ] && ! shopt -oq posix;
then then
@ -81,7 +85,7 @@ else
# Adds paths and custom .bashrc # Adds paths and custom .bashrc
echo " echo "
export PATH=\"$PWD/git:$PATH\" export PATH=\"$PWD/git/scripts:$PATH\"
if [ -f $PWD/bashrc ] && ! shopt -oq posix; then if [ -f $PWD/bashrc ] && ! shopt -oq posix; then
. $PWD/bashrc . $PWD/bashrc