public
Created

Create a remote git branch & checkout locally (with tracking)

  • Download Gist
branch.sh
Shell
1 2 3 4 5 6 7 8 9
if [ -z $1 ]; then
echo STDERR "Usage: $0 [branchname]"
exit 1
fi
 
echo "Creating local+remote git branch: $1"
git push origin origin:refs/heads/$1
git fetch origin
git checkout -b $1 --track origin/$1

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.