Created
July 12, 2012 01:40
-
-
Save grafikchaos/3095081 to your computer and use it in GitHub Desktop.
git create and track remote branch
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
# 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' |
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
#!/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