Skip to content

Instantly share code, notes, and snippets.

@grafikchaos
Created July 12, 2012 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grafikchaos/3095081 to your computer and use it in GitHub Desktop.
Save grafikchaos/3095081 to your computer and use it in GitHub Desktop.
git create and track remote branch
# in your aliases
# make sure your git-create-branch.sh is executable -> chmod +x path/to/your/git-create-branch.sh
alias gcb='path/to/your/git-create-branch.sh'
#!/bin/sh
# git-create-branch <branch_name>
if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 branch_name
exit 127
fi
git push origin origin:refs/heads/$1
git fetch origin
git branch --track $1 origin/$1
git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment