Created
July 11, 2011 15:36
-
-
Save pkqk/1076107 to your computer and use it in GitHub Desktop.
mentalist git hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh user@remote-server | |
cd /path/to/working-tree | |
git config receive.denyCurrentBranch ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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