Last Updated: February 25, 2016
·
1.225K
· josemota

Save disk space when cloning Git repos

I use Vim a lot and I use Pathogen to sort my list of plugins. Since I don't really contribute to them, I just consume them, I don't really need to have the full history of the code base.

git clone has the depth option which allows you to specify how deep you want to clone a repository. In this particular scenario, to clone Tim Pope's vim-surround plugin, you would type:

$ cd ~/.vim/bundle
$ git clone --depth 1 git://github.com/tpope/vim-surround

You get the latest snapshot of the plugin and save up space. It's not that big of a deal when you use one or two plugins, but if you use ten big ones like I do, you might wanna do this.