How to clone a specific branch in git bitbucket

ruby student picture ruby student · May 1, 2015 · Viewed 61.4k times · Source

I want to clone a specific branch. I don't want download the master branch.

How do I clone the whole project and then switch to validations branch?

Answer

sfletche picture sfletche · May 1, 2015

You can clone a single branch (without inadvertently cloning the whole project) with the following:

git clone <url> --branch <branch> --single-branch [<folder>]

Alternatively (attempting to address your new question here...), you can clone the whole project

git clone <url> 

Change directories into the folder and creating a new branch off of master with

git checkout -b validations