Skip to content

Instantly share code, notes, and snippets.

@shearluck
Last active August 29, 2015 14:06
Show Gist options
  • Save shearluck/858eba5a17a2b0f47796 to your computer and use it in GitHub Desktop.
Save shearluck/858eba5a17a2b0f47796 to your computer and use it in GitHub Desktop.
Git post-receive script - checkout based on currently pushed local branch
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref`
echo "Pushing to branch $branch"
done
git --work-tree=/path/to/deploy/files --git-dir=/path/of/baregit.git checkout $branch -f
echo "All done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment