Open rogerxu opened 6 years ago
$ git clone --no-tags <repository>
.git/config
[remote "origin"]
url = https://xxx/xxx.git
tagOpt = --no-tags
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
$ git clone --depth 10 <repository>
Clone master
branch
$ git clone <repository> --single-branch
Clone a specific branch
$ git clone <repository> --branch <branch>
$ git fetch --depth=10 origin master
$ git fetch --depth=10 origin refs/heads/master:refs/remotes/origin/master
$ git config core.sparsecheckout true
$ echo src/ > .git/info/sparse-checkout
$ git read-tree -m -u HEAD
android - how to git clone with specific revision and depth=1 - Stack Overflow
If revision is a branch (refs/heads/xxx
) or a tag (refs/tags/xxx
),
$ git clone -b $revision --depth=1 $repository
$ git fetch --depth=1 $repository $revision
$ git checkout FETCH_HEAD
If revision is a specific commit or a ref under other namepaces, not refs/tags/
or refs/heads/
,
$ git fetch --depth=1 $repository $revision
$ git checkout FETCH_HEAD
Git - partial-clone Documentation Partial Clone for Large Repositories | GitLab
$ git clone --no-checkout --filter=blob:none <repository>
Git - git-clone Documentation
How to manage big Git repositories
Partial clone with Git and Mercurial - Stack Overflow