Questions tagged [shallow-clone]
82 questions
183
votes
3 answers
git shallow clone (clone --depth) misses remote branches
After cloning a remote repository it does not show any remote branch by -a option. What could be the problem? How to debug it? In this snippet two of the remote branches are not shown:
$ git clone --depth 1…

minghua
- 5,981
- 6
- 45
- 71
166
votes
5 answers
How to shallow clone a specific commit with depth 1?
Is it possible to shallow clone a specific commit in a repository, i.e. with depth 1? Something like
git clone http://myrepo.git 728a4d --depth 1
to get the repository state as it is at the commit with SHA 728a4d...?
The motivation is to avoid…

Chin
- 19,717
- 37
- 107
- 164
102
votes
1 answer
How do I shallow clone a repo on a specific branch?
How do I shallow clone a git repository, so that my clone contains only 1 history item, and starts on a specific branch?
I know how to do a shallow clone:
git clone --depth 1 https://path/to/myrepo.git
but not start the clone on a specific branch.

joseph.hainline
- 24,829
- 18
- 53
- 70
99
votes
3 answers
How to clone seed/kick-start project without the whole history?
Note that using --depth=1 parameter prevents you from pushing the project to a new repository.

itamar
- 1,800
- 4
- 17
- 30
71
votes
5 answers
How to git fetch efficiently from a shallow clone
We use git to distribute an operating system and keep it upto date. We can't distribute the full repository since it's too large (>2GB), so we have been using shallow clones (~300M). However recently when fetching from a shallow clone, it's now…

hendry
- 9,725
- 18
- 81
- 139
33
votes
3 answers
Set Git submodule to shallow clone & sparse checkout?
Many vendor Objective-C libraries (e.g., facebook-ios-sdk) instruct you to copy a certain subset of its repo's files/dirs into your Xcode project. One problem with this is then you do not know what revision of the vendor code you have. Another is…

ma11hew28
- 121,420
- 116
- 450
- 651
30
votes
3 answers
How to fetch enough commits to do a merge in a shallow clone
What I'm trying to do: test pull requests from github. I want to locally merge a pull request into master and run some tests on the result. Since the repository is huge, I do a shallow clone.
To be able to do the merge, I fetch more and more commits…

madjar
- 12,691
- 2
- 44
- 52
26
votes
6 answers
Pushing to github after a shallow clone
I had a massive git repo because of a huge number of commits, so following advice here I created a shallow clone. I've made changes to this new local repo, and now I want to push to my origin at Github (and then on to my staging and production…

snowangel
- 3,452
- 3
- 29
- 72
25
votes
1 answer
git clone: warning: --depth is ignored in local clones; use file:// instead
We have a remote repository on a shared folder in our local network. I attempted to make a shallow clone:
git clone --depth 1 //gitrepos-pc/git/foo/
It gave me this warning, and made a full clone:
warning: --depth is ignored in local clones; use…

sashoalm
- 75,001
- 122
- 434
- 781
17
votes
4 answers
Disadvantages of shallow cloning on Travis and other CI services?
Most CI services provide a way to shallow clone a repository. For example, on Travis:
git:
depth: 1
or on AppVeyor:
clone_depth: 1
or
shallow_clone: true
This has the obvious benefit of speed, since you don't have to clone the whole repository.…

Chin
- 19,717
- 37
- 107
- 164
16
votes
1 answer
Git shallow fetch of a new tag
If I clone a repository with max depth of 1 at a tag, it works and pulls down just that. If I then want to do a fetch with or without depth of 1 for a new tag, it does some processing, but the tag never shows up under 'git tag'. If I supply the…

Adam Watkins
- 195
- 1
- 8
14
votes
3 answers
Can I clone just the latest changesets of a repository instead of the entire history?
I have to work with an hg repository that has millions of lines of code and hundreds of thousands of changesets. As you can imagine, this really slows down mercurial and TortoiseHg.
Is it possible for me to create a local repository that only has…

PortMan
- 4,205
- 9
- 35
- 61
13
votes
3 answers
SonarQube with shallow clone warning even with shallow disabled on Jenkins build
I have a Jenkins server building a solution using MSBuild. Shallow Clone is not enabled (on Advanced Clone Behaviours), so I supposed it's getting all the last commits. And I'm using SonarQube to analyze. I set to run the Begin Analysis before build…

Samuel Finatto
- 147
- 1
- 1
- 7
12
votes
1 answer
Shallow clone with submodules in git, how to use pointed commits and not latest ones?
I know it's possible to have shallow submodules using the --depth option with git submodule update.
However, If I run
git submodule update --init --recursive --depth 1
on my project with several submodules, I get a fatal: reference is not a tree.…

elnigno
- 1,751
- 14
- 37
11
votes
1 answer
JS Recursive object assign
I learned that when using Object.assign() it extends only the top level object. How can I deeply extend the object? For example, let's say I have the following source object:
const source = {
id: 1,
otherKey: {},
params: {
page: {
a:…

undefined
- 6,366
- 12
- 46
- 90