Search code examples
gitjenkinsshallow-clone

What's the difference between depth and shallow options when cloning with Git plugin in Jenkins


I've read a lot of posts and articles in the Internet (even the Git official doc) but I still do not understand the difference between using depth: n and shallow: true. The official documentation (https://plugins.jenkins.io/git/) do not even show the depth: n option. After trying different combinations I do not understand what is the difference between them.


Solution

  • shallow=true tells the plugin to only check out a shallow copy (without the full history). Once it's enabled, you can also set the depth option to define how many commits of history you want to get when performing a shallow clone.