Skip to content

Instantly share code, notes, and snippets.

@kogakure
Created October 26, 2009 07:02
Show Gist options
  • Save kogakure/218467 to your computer and use it in GitHub Desktop.
Save kogakure/218467 to your computer and use it in GitHub Desktop.
Bash: Git - New remote branch
#!/bin/sh
# http://www.zorched.net/2008/04/14/start-a-new-branch-on-your-remote-git-repository/
# git-create-branch <branch_name>
if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 branch_name
exit 127
fi
branch_name=$1
git push origin master:refs/heads/$branch_name
echo "git push origin master:refs/heads/$branch_name"
git fetch origin
git checkout --track -b $branch_name origin/$branch_name
git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment