Git Cheat Sheet/Clone a single branch

Clone only one branch history.

Section: Repository Creation and Discovery

Clone a single branch

bash
bash
git clone --branch main --single-branch https://github.com/owner/repo.git

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Repository Creation and Discovery
Clone via HTTPS
Clone a remote repository.
OpenIn sheetbashsame section
Shallow clone
Clone limited history for faster checkout.
OpenIn sheetbashsame section
Partial clone with blob filter
Reduce object download size for large repos.
OpenIn sheetbashsame section
Initialize repository
Create a new repository in the current directory.
OpenIn sheetbashsame section
Initialize bare repository
Create a repository without a working tree for server or shared use.
OpenIn sheetbashsame section
Show repo root
Print the top-level working tree directory.
OpenIn sheetbashsame section