Make Better Things

I like to make better things.

Clone a Git repo without history (just latest commit)

One common problem with big git repos is it takes a lot of time to clone, because in cloning git download everything beginning form the first commit. Sometimes we don’t need that much of history with code.

We can use “–depth” option in “git clone” command to specify how many commits we need. By providing an argument of “–depth 1″ to the clone command, the process will copy only the latest revision of everything in the repository.

For example -

git clone --depth 1 jquery

This command only clones the HEAD of the jqueyr repository.

Note: Prior to git 1.9 we can’t use do pull or push on such repos.

how to git clone with submodules

For git version 1.6.5 or later just use -

git clone --recursive git://

for already cloned repos or older git version please run -

git clone git://
cd bar
git submodule update --init --recursive