Last active
May 6, 2016 13:53
-
-
Save g-i-o-/94a467a095a371de1b398f507ff6cc1d to your computer and use it in GitHub Desktop.
git-on :: for performing stuff on ther branches without all the (manual) switcharoo.
This file contains hidden or 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
#!/bin/bash | |
if [ "$2" != "do" ]; then | |
echo "Runs a git command on the given branch and returns to this one." | |
echo "Usage:" | |
echo " git on [branch] do [normal git command] [arg1] ..." | |
exit | |
fi | |
tbranch="$1" | |
shift | |
shift | |
cbranch=`git rev-parse --abbrev-ref HEAD` | |
echo "git checkout $tbranch" | |
git checkout $tbranch | |
echo "git $@" | |
git $@ | |
echo "git checkout $cbranch" | |
git checkout $cbranch | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment