libgit2 / pygit2

Python bindings for libgit2
https://www.pygit2.org/
Other
1.58k stars 382 forks source link

pygit2: How to implement `git clone --single-branch`? #1290

Open leiless opened 1 month ago

leiless commented 1 month ago
$ git clone -h
usage: git clone [<options>] [--] <repo> [<dir>]
...
    -b, --branch <branch>
                          checkout <branch> instead of the remote's HEAD
...
    --single-branch       clone only one branch, HEAD or --branch

Hi, all. git clone has an option (i.e. --single-branch) to specify only clone one branch. Just wonder if anyone knows how to implement this functionality with pygit2?

With --single-branch, git branch -a will has only one branch, not all remote branches.

--

Might be helpful: https://github.com/libgit2/libgit2/issues/2924 https://github.com/nodegit/nodegit/issues/1669