Skip to content

Instantly share code, notes, and snippets.

@renexdev
Forked from roscius/git_remote_branches.sh
Created June 28, 2017 13:08
Show Gist options
  • Save renexdev/cef405d262c8202da0a519cd2d0171d6 to your computer and use it in GitHub Desktop.
Save renexdev/cef405d262c8202da0a519cd2d0171d6 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