Skip to content

Instantly share code, notes, and snippets.

@jhthorsen
Created March 13, 2012 20:55
Show Gist options
  • Save jhthorsen/2031515 to your computer and use it in GitHub Desktop.
Save jhthorsen/2031515 to your computer and use it in GitHub Desktop.
post-receive hook for git
#!/bin/sh
BACKUP=$GIT_DIR; # need to be first?
GIT_DIR="path/to/my/repo/.git";
while read oldrev newrev refname; do
BRANCH=$(echo $refname | cut -f3 -d/);
echo branch $BRANCH
if [ "x$BRANCH" = "xalien" ]; then
cd $GIT_DIR;
/usr/bin/git merge $BRANCH;
fi
done
GIT_DIR=$BACKUP;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment