Skip to content

Instantly share code, notes, and snippets.

@pkqk
Created July 11, 2011 15:36
Show Gist options
  • Save pkqk/1076107 to your computer and use it in GitHub Desktop.
Save pkqk/1076107 to your computer and use it in GitHub Desktop.
mentalist git hook
ssh user@remote-server
cd /path/to/working-tree
git config receive.denyCurrentBranch ignore
#!/bin/bash
while read oldref newref branchname
do
case $branchname in
"refs/heads/master")
echo "Updating remote repo"
git push user@remote-server:/path/to/working-tree.git master:master &&
ssh user@remote-server "cd /path/to/working-tree && git reset --hard $newref"
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment