Skip to content

Instantly share code, notes, and snippets.

@tapannallan
Last active August 29, 2015 14:21
Show Gist options
  • Save tapannallan/701d3c22ebb5a709504b to your computer and use it in GitHub Desktop.
Save tapannallan/701d3c22ebb5a709504b to your computer and use it in GitHub Desktop.
githookup
#!/bin/sh
#title :git-hookup
#description :Custom git command.
#author :tapan.chandra@jda.com
#date :20150730
#version :0.5
#usage :git hookup
#notes :
#==============================================================================
echo JDA Software Pvt Ltd
is_git_dir=`ls -ap | grep .git/`
if [ "$is_git_dir" = ".git/" ]; then
if [ -e .hooks ]; then
cd .hooks
cnt=`ls -1|wc -l`
echo Searching for client hooks : $cnt found
FILES=*
for f in $FILES
do
if [[ "$f" != *\.* ]]
then
if [ -e "../.git/hooks/$f" ];
then
echo "Error : An instance of $f hook was already found in the .git/hooks directory"
echo "You need to manually merge .hooks/$f with .git/hooks/$f"
else
cp "$f" "../.git/hooks/$f"
echo "Installed $f hook"
fi
fi
done
fi
else
echo This is not a git repo. Nothing to do here.
exit 0
fi
echo You are hooked up now. Commit when you are ready.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment