Created
February 27, 2014 17:29
-
-
Save joelmccracken/9254854 to your computer and use it in GitHub Desktop.
perform command on another branch
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
git-on-branch () { | |
git stash | |
ORIGINAL_BRANCH=`git branch | grep \* | sed 's/\*[[:space:]]//'` | |
git checkout $1 | |
$2 | |
git checkout $ORIGINAL_BRANCH | |
git stash pop | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment