If you are working on a projects that uses Git version control and you are looking to clone a specific branch to your local system here is the solution.
Clone only the specific branch and not download others
Chances are that you have multiple remote branches on the repository and you are looking to only work on a single branch. If you are not concerned about switching to other branches and only want to work on the single branch.
Here is the command you should use
git clone --single-branch --branch <branchname> <remote-repo>
Clone the specific branch and also download other branches
If you are looking to clone a specific branch and also want to have copy of all the other branches on your local so that you can switch between them.
Here is the command you should use to clone
git clone -b <branch> <remote_repo>
That’s all about cloning a specific git branch on local.