Home » Git Clone Specific Branch

Git Clone Specific Branch

To clone a specific branch, run git branch with the -b option and specify the branch to clone.


git clone -b <branch_name> <git_repo_url>

Example : You would run the below command to clone the task1 branch of your Github repository.

git clone -b task1 https://github.com/onnxy/proj.git

Run the git branch command to cross check that you have cloned the right branch. The branch name should appear if the run the git branch command.

git branch


Also Read:

How to Clone Git Repository into specific Folder