Skip to main content

Command Palette

Search for a command to run...

single-branch parameter in the git clone

Published
1 min read

Despite having a small amount of storage on your local, do you need to do a task in a specific branch of Git? Or, for a variety of reasons, you might only wish to clone a certain branch's files.

Git, fortunately, allows the flexibility to accomplish this with single-branch parameter.

What is the single-branch parameter in the git clone?

It allows you to only fetch files from the specified branch and only tracks that branch without fetching other branches.

git clone -b <branchname> — single-branch <remote-repo-url>

Or

git clone — branch <branchname> — single-branch <remote-repo-url>