Git: Clone a specific branch
If you want a specific branch of a repo, rather than running:
git clone <remote-repo>
git checkout <branch-name>
you can combine these commands:
git clone --branch <branch-name> <remote-repo>
If you only want a specific branch, you can use the --single-branch
option:
git clone --single-branch --branch <branch-name> <remote-repo>
Via SO.
Leave a comment