Quantcast
Channel: How do I check out a remote Git branch? - Stack Overflow
Viewing all articles
Browse latest Browse all 49

Answer by Madhan Ayyasamy for How do I check out a remote Git branch?

$
0
0

To clone a Git repository, do:

git clone <either ssh url /http url>

The above command checks out all of the branches, but only the master branch will be initialized. If you want to checkout the other branches, do:

git checkout -t origin/future_branch (for example)

This command checks out the remote branch, and your local branch name will be same as the remote branch.

If you want to override your local branch name on checkout:

git checkout -t -b enhancement origin/future_branch

Now your local branch name is enhancement, but your remote branch name is future_branch.

Documentation


Viewing all articles
Browse latest Browse all 49

Trending Articles