The size of a repository can grow in two orthogonal directions:
- The size of the history
- 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).
Git allows a shallow copy, keeping only the latest n commits, with the command:
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.