chipbk10 chipbk10 - 3 months ago 19
Git Question

Which branch I have when cloning a git repository?

When cloning a git repository, actually from which branch I did clone?

I mean on my git server, there are many branches: master, develop, features, bugs.

When I clone the project, I clone from which branch? I want to clone from the develop branch. How can I do that?


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:

enter image description here

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.