Skip to content

Instantly share code, notes, and snippets.

@unarist
Created June 24, 2015 09:11
Show Gist options
  • Save unarist/e8435023b28abf8fad5d to your computer and use it in GitHub Desktop.
Save unarist/e8435023b28abf8fad5d to your computer and use it in GitHub Desktop.
pushdeploy
#!/bin/sh
set -e
# cd .git/hooks/../..
cd $(dirname "$0")/../..
unset GIT_DIR
# read arguments
read oldrev newrev refname
branch=${refname#refs/heads/}
echo "Checkout branch and reset worktree..."
git checkout -f $branch && git reset --hard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment