Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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