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

Category: Git - Core

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

Clone a specific branch only

Clones only a specific branch from the repository instead of all branches.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.