I'm trying to clone a specific branch (the "dev" branch) of a GitHub repository. With the git command I can run something like
git clone --branch dev https://github.com/user/repo
What's the equivalent of this in gh
(GitHub CLI)? I can't find it in the docs
CodePudding user response:
You can try this:
git clone link_repo -b branch_name --single-branch
In your case, we use cmd:
git clone https://github.com/user/repo -b dev --single-branch
CodePudding user response:
Try the following command to clone a specific branch
.
git clone --single-branch --branch <branch-name> <url>
Example:
git clone --single-branch --branch dev https://github.com/test-repo.git
where, dev
is the branch
name.
https://github.com/test-repo.git
is the url.