How to use git to get just the latest revision of a project?


I don't want to clone the full repository and I'm not going to be submitting patches. I do want to easily get new revisions in the future.

I have tried using git clone, but this creates a copy of the entire repository (huge file size) and tracking changes makes the disk space even bigger (100mb of files now takes up over 2gb).

Is this possible?


Use git clone with the --depth option set to 1 to create a shallow clone with a history truncated to the latest commit.

For example:

git clone --depth 1

To also initialize and update any nested submodules, also pass --recurse-submodules and to clone them shallowly, also pass --shallow-submodules.

For example:

git clone --depth 1 --recurse-submodules --shallow-submodules

How do I rename both a Git local and remote branch name?

Export a stash to another computer