Skip to content

Instantly share code, notes, and snippets.

@canton7
Created September 4, 2011 20:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save canton7/1193421 to your computer and use it in GitHub Desktop.
Save canton7/1193421 to your computer and use it in GitHub Desktop.
Different ways of creating new local tracking branches

Ways to create a new local branch, tracking a remote branch

Create a new local branch with the same name as the remote one

git checkout <remote_branch_name>
git checkout -t <remote>/<remote_branch_name>

Create a new local branch with a different name to the remote one

git checkout -b <local_branch_name> <remote>/<remote_branch_name>

These assume that you haven't changed any config settings which affect whether tracking is automatically set up, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment