Cloning specific branch

前端 未结 7 894
南笙
南笙 2021-01-31 09:40

I am new to git version control and I dont know how to clone / pull a specific branch of a repo . Trying to get the branch master of the project, but it defaults to

7条回答
  •  佛祖请我去吃肉
    2021-01-31 10:04

    I don't think you fully understand how git by default gives you all history of all branches.

    git clone --branch master will give you what you want.

    But in fact, in any of the other repos where you ended up with test_1 checked out, you could have just done git checkout master and it would have switched you to the master branch.

    (What @CodeWizard says is all true, I just think it's more advanced than what you really need.)

提交回复
热议问题