Skip to content

Instantly share code, notes, and snippets.

@un33k
Created May 8, 2012 02:01
Show Gist options
  • Save un33k/2631974 to your computer and use it in GitHub Desktop.
Save un33k/2631974 to your computer and use it in GitHub Desktop.
Create a git branch
#!/bin/sh
# git-create-branch <branch_name>
if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 branch_name
exit 127
fi
set branch_name = $1
git push origin origin: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