Created
February 8, 2015 07:26
-
-
Save drosenstark/ad88360e01edbed975be to your computer and use it in GitHub Desktop.
Dan's Git Rbranch
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
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD); | |
echo "git-rbranch: Creating local branch $1" | |
git checkout -b $1 # make the branch locally | |
echo "git-rbranch: Pushing $1 to the server" | |
git push origin $1 #push it to the server | |
echo "git-rbranch: Checking out $CURRENT_BRANCH again" | |
git checkout $CURRENT_BRANCH # switch to $1 | |
echo "git-rbranch: Setting origin/$1 as the tracking branch" | |
git branch -f $1 origin/$1 # branch to $1, using origin/$1 as the tracking branch | |
echo "git-rbranch: Checking out $1 with the right origin" | |
git checkout $1 # checkout the $1 branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment