Shallow clones with git
In setting up a continuous integration server I discovered this command:
git clone --branch #{git_branch} --depth 1 #{git_repo}
Using the —depth option and setting it to 1 creates a shallow clone of your git repo. It basically truncates your history to the specified number of revisions. For something like CI servers (and possibly production servers) you don’t need full history, just the most recent version of your code. This saves time in pulling down the repo from your remote host.
(Source: kernel.org)