Skip to content

Instantly share code, notes, and snippets.

@akesterson
Created June 20, 2013 20:33
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 akesterson/5826348 to your computer and use it in GitHub Desktop.
Save akesterson/5826348 to your computer and use it in GitHub Desktop.
#!/bin/bash
cd ..
GIT_DIR=.git
if ! [ -t 0 ]; then
read -a ref
fi
IFS='/' read -ra REF <<< "${ref[2]}"
BRANCH="${REF[2]}"
umask 002 && git reset --hard && git checkout $BRANCH && git reset --hard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment