Skip to content

Instantly share code, notes, and snippets.

@roscius
Forked from thisivan/git_remote_branches.sh
Created May 20, 2012 20:12
Show Gist options
  • Save roscius/2759402 to your computer and use it in GitHub Desktop.
Save roscius/2759402 to your computer and use it in GitHub Desktop.
Git: Track Remote Branches
# Create new remote branch
git push origin origin:refs/heads/new_branch_name
# Make sure everything is updated
git fetch origin
# Check your branch has been created
git branch -r
# Track a remote branch
git branch --track new_branch_name origin/new_branch_name
# Checkout remote branch
git checkout new_branch_name
# Delete local branch
git branch -d branch_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment