Skip to content

Managing Large Repos

Published On:
Jan 12, 2015
Last Updated:
Jan 12, 2015

The size of a repository can grow in two orthogonal directions:

  1. The size of the history
  2. The size of the current repo data

Obviously, if a shallow copy has not been performed, the size of the history is always equal or greater than the size of the current repo data (assuming no compression has taken place, and the repo has no uncommitted changes).

Shallow Clones

Git allows a shallow copy, keeping only the latest n commits, with the command:

Terminal window
$ git clone --depth n

Git version 1.9 improved the capabilities of shallow clones dramatically, giving them full push/pull support between the shallow copy repo and a repo with the entire history.

As of 2015-01, Mercurial does not support this feature.