Git Cheatsheet - Quick Git Command Reference

Quick reference for common Git commands. Search, copy, and use Git commands instantly.

Share
Back to Git Cheatsheet

git clone

Clone a remote repository

Syntax

git clone [options] <url> [directory]

Common Options

OptionDescription
-b <branch>Clone specific branch
--depth <n>Shallow clone, only last n commits
--recursiveRecursively clone submodules
--mirrorClone mirror (all refs)
--single-branchClone single branch only
--branch <tag>Clone specific tag
--no-checkoutNo checkout after clone

Examples

git clone https://github.com/user/repo.git

Clone remote repository

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

Clone specific branch

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

Shallow clone latest commit

git clone --recursive https://github.com/user/repo.git

Clone with submodules

Related Tools

More Code & Dev Tools