Skip to content
Versora

Manual

Repository

Shallow clone and partial clone

3 min read

On this page

Large repositories take a long time to clone. Git has two ways to download less:

  • Shallow clone: downloads only the most recent commits. The graph ends where the local history does.
  • Partial clone: downloads the whole history, but the contents of old files only when they're needed.

Versora creates both types through the clone's advanced options and shows in the repository bar when a repository is shallow or partial. In a shallow repository, the bar offers to download more history.

Creating a shallow or partial clone

The Clone repository window is described in Open, clone and create repositories. This section explains only the Advanced options (the title gets "changed" when any of them is on).

OptionWhat it doesCommandDefault
Shallow clone — only the last N commitsDownloads only the N most recent commits. "Faster and smaller. The rest of the history can be downloaded later from the "Shallow clone" bar."git clone --depth=NOff (N = 1 when on)
Branch (optional)Branch to download and leave checked out.git clone --branch <branch>Empty: the remote default
Download only this branchThe remote's other branches aren't downloaded.git clone --single-branchOff
Also clone submodulesClones and initializes the submodules along with it.git clone --recurse-submodulesOff
Partial clone — file contents on demandThe full history is downloaded, but the contents of old files are fetched only when needed.git clone --filter=blob:noneOff

With shallow clone on and Download only this branch off, the app adds --no-single-branch: without it, --depth alone would already limit the clone to one branch.

Caution

Partial clone requires a server that supports filters (recent GitHub, GitLab and Gitea). In a partial repository, viewing files from old commits requires a connection to the server.

The "Shallow clone" bar

In a shallow repository, the repository bar shows Shallow clone (tooltip "Shallow clone: only the most recent commits were downloaded. The graph ends where the local history does.") with two buttons.

Where to find it

Repository bar: Fetch more history… and Fetch full history.

Step by step

  1. To download just a little more, click Fetch more history…. The Fetch more history window asks how many more commits to download, starting where the history ends. The Additional commits field comes with 50.
  2. Click Fetch. The notice says "Fetched 50 more commits of history".
  3. To download everything at once, click Fetch full history. The repository is no longer shallow ("Full history downloaded") and the bar goes away.

What Versora does in git

bash
git fetch --deepen=50
git fetch --unshallow

How to undo

Downloading more history doesn't change local branches or files, and it isn't part of Ctrl+Z. There's no way to make the repository shallow again from the app: for that, clone again with the shallow clone option.

Caveats and messages

  • "Enter a whole number of commits, 1 or more."
  • "This repository already has the full history.": there's nothing to download.
  • Network and credential errors appear as in any other fetch: see Fetch.

The "Partial clone" bar

In a partial repository, the bar shows Partial clone (tooltip "Partial clone (filter ‹filter›): file contents are downloaded from the remote when needed. Some operations need a network connection."). There's no action: the bar only reminds you that some operations need a connection to the server, such as viewing files from old commits.

To turn a complete repository into a partial one, you have to clone again, into a new folder. The Optimize repository screen suggests this for repositories with a very large history and has the Clone with options… button.

There's no setting of its own.

See also