git clone a specific branch

git clone -b feature/login https://github.com/user/repo.git

You only need one branch of a large repository, or you want to clone a non-default branch directly.

Clone with only the latest commit (shallow + single branch)

Fastest option for CI/CD — downloads only the tip of one branch.

git clone --depth 1 -b feature/login https://github.com/user/repo.git

Switch to a different branch after cloning

git fetch origin other-branch
git checkout other-branch

Clone a specific tag

git clone -b v2.1.0 https://github.com/user/repo.git