Edit, February 2017: This answer is deprecated / erroneous. Git can make a small clone smaller, at least internally. Git 2.11 also has --deepen to increase clone depth, and it looks like there are possible plans to allow negative values ββ(although now they are rejected). It's not clear how well this works in the real world, and your best bet is to clone a clone, as in jthill's answer .
You can only deepen the repository. This is primarily due to the fact that Git is created around adding new material. The path to small clones is that your (receiving) Git receives the sender (another Git) to stop sending "new material" when it reaches the depth-cloning argument and the coordinate with the sender to understand why they stopped at that moment, although obviously more history is required. Then they write the identifiers of the βtruncatedβ commits to a special .git/shallow file, which both places the repository as shallow, and the notes that commit are truncated.
Note that during this process, your Git is still adding new things. (In addition, when he completed the cloning and exits, Git forgot what depth is, and over time it becomes impossible to even figure out what it is. All Git can say that it is a shallow clone, because the .git/shallow file contains identifiers commit, still exists.)
The rest of Git continues to be built around this concept of βadd new material,β so you can deepen the clone, but not increase its superficiality. (There is nothing good, consistent verb for this: the opposite of the deepening of the pit fills it, but the filling has the wrong connotation. Diminish may work, I think I will use it.)
In the theory of git gc , which is the only part of Git that ever actually kicks something, 1 may possibly reduce the repository, even turning the complete clone into a small one, but no one wrote the code for this. There are a few complex bits, for example, do you drop tags? Shallow clones start using sans tags for implementation reasons, so converting a repository to a shallow one or reducing the existing shallow storage might require dropping at least some of the tags. Of course, any tag indicating a commit destroyed by a decreasing action should go away.
Meanwhile, the --depth argument to git-pack-objects (passed through git repack ) means something else: the maximum length of the delta chain when Git uses its modified xdelta compression on Git objects stored in each pack file. This has nothing to do with the depth of individual parts of the DAG commit (as calculated from each branch of the branch).
1 Well, git repack completes throwing things away as a side effect, depending on which flags are used, but it invoked this path on git gc . This is true for git prune . In order for these two teams to really do their job properly, they need to start git reflog expire first. "Normal user" end of the sequence "clean" - git gc ; he is dealing with all of this. Therefore, we can say that git gc is how you discard the accumulated "new material", which turned out to be undesirable in the end.