K
K
krll-k2014-07-18 12:16:45
git
krll-k, 2014-07-18 12:16:45

When cloning a repository, only the master branch is cloned. Why?

When cloning a repository, only the master branch is cloned. How can I clone all the others besides the master branch?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EXL, 2014-07-18
@krll-k

No, all remote branches are cloned. They just have the prefix origin/remote_branch . But only the master -> origin/master branch becomes tracked .
To make another tracked branch, switch to a remote branch and create a local branch. All this can be done with one command:
Where local_branch_name is the name of the branch being created, origin/remote_branch_name is the full name of the remote branch; local_branch_name can be named the same as remote_branch_name for convenience. After executing the command, you will have a local_branch_name branch that will track the remote_branch_name branch on the server.

Z
zxmd, 2014-07-18
@zxmd

You can clone a specific branch. More precisely, in any case, you will clone the entire repository, but the specified one will be put into working condition.
git clone -b

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question