Wednesday, March 25, 2015

Save time and disk space when using Git

By default Git will copy the full history when you clone a repository. This is one of the advantages of a distributed source control system as you have the full history locally. But what if you have a project that accumulated years of project history in your repository?

The solution is a shallow clone. A shallow clone allows you to clone a repository keeping only the latest n commits of history.

How can you do this? Just use the - -depth option:

git clone --depth depth remote-url

Remark: This can also save some time on your build server. Hint, hint…

No comments: