Skip to content

Instantly share code, notes, and snippets.

@whostolemyhat
Created November 7, 2016 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whostolemyhat/26996f95e6fa455d70ef30b8ce57215d to your computer and use it in GitHub Desktop.
Save whostolemyhat/26996f95e6fa455d70ef30b8ce57215d to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check out the branch just pushed
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ]; then
GIT_WORK_TREE=~/myproject git checkout $branch -f
echo "/==========================================/"
echo "| Checked out branch: $branch |"
echo "/==========================================/"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment