Which branch I have when cloning a git repository?

This question already has an answer here:

  • How to clone a single branch in git? 14 answers
  • What determines default branch after “git clone”? 3 answers

  • By default, following the clone operation, you will be on the branch that has been marked as the default branch within the git configuration. Assuming for instance you are using GitHub this is configurable through the Settings page:

    在这里输入图像描述

    Once you have cloned the repository, you can then do git checkout <branchname> to move into the branch that you are interested in.

    Alternatively, you can change the default branch, if that makes sense for you, and your team.


    You can clone a specific branch by adding the parameter --single-branch and the branch name by -b <branch name>

    A clone command to clone the branch develop to the current working directory would look like this:

    git clone -b develop --single-branch git://my.repository.url

    Source: Documentation of git clone

    链接地址: http://www.djcxy.com/p/90442.html

    上一篇: 我可以使用有限分支集创建GIT分支吗?

    下一篇: 克隆git存储库时我拥有哪个分支?