Skip to contentSkip to conversation

question about git and remote repositories

DISCUSSION Ittay Dror 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

Ittay Dror

author
#0 lore raw

Hi,

If I want to start working on a project that uses git (and I want to use git also), I first need to clone the project's repo. That is very slow (using the git:// protocol). Are there alternatives? For example, as far as I understand, if all I want is to get the latest commit in HEAD, branch from it and start working, then all git really needs to have is all objects referenced from that commit (commit, trees, blobs) and that's it, right? (as long as I don't expect to see full log of past operations)

Thanks,
Ittay

Signature · 3 lines
Ittay Dror <[email protected]>
Tikal <http://www.tikalk.com>
Tikal Project <http://tikal.sourceforge.net>
#1 lore raw
Quoted 8 lines · Ittay Dror

If I want to start working on a project that uses git (and I want to use git also), I first need to clone the project's repo. That is very slow (using the git:// protocol). Are there alternatives? For example, as far as I understand, if all I want is to get the latest commit in HEAD, branch from it and start working, then all git really needs to have is all objects referenced from that commit (commit, trees, blobs) and that's it, right? (as long as I don't expect to see full log of past operations)

In git terms, that is called a "shallow clone". For example:

git clone --depth 5 git://site.com/repo.git

would clone all the heads of repo.git along with their 5 most recent commits.

You can make history deeper with

git-fetch --depth 20 git://site.com/repo.git branch

See the glossary, technical/shallow.txt, git-clone and git-fetch man pages.

#2 lore raw
In reply to Ittay Dror
Quoted 5 lines · Ittay Dror

For example, as far as
I understand, if all I want is to get the latest commit in HEAD, branch from it and start working, then all git really needs to have is all objects referenced from that commit (commit, trees, blobs) and that's it, right? (as long as I don't expect to see full log of past operations)

It can be quite addictive to have the entire revision history of the entire project sitting locally on your disk. Once you've tried it, it's hard to go back. :)

But if you still want only the last few revisions, try using the --depth option to git-clone.

Have fun,

Avery