Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is this git shallow clone bigger than I expected?

Tags:

git

I have a repo that is about 24MB in size but the files in the project are actually just around 2MB. I was under the impression that a shallow clone with --depth 1 would pretty much get me down close to the 2MB of the actual files (sans entire repo).

When I do the shallow clone the new repo shows only the current branch but the size is identical (24MB) and looking at the repo with gitx I can see the entire history back to the initial commit.

I'd like a way to get just the current state of files (for uploading to a server) without all the history. Am I doing something wrong or just misunderstanding the purpose of the shallow clone?

like image 427
kjs3 Avatar asked Jan 02 '10 19:01

kjs3


1 Answers

If this is a local clone, then the clone may be operating by hard linking objects in your new repository to those in your old repository (it does this as an optimization on local file systems). To see if this is the case, you can disable hard linking:

git clone --depth 1 --no-hardlinks /path/to/repo.git

If you're just trying to get the current state of files to upload to a server, you should use git archive to generate a ZIP or tar archive of your tree.

like image 144
Brian Campbell Avatar answered Oct 06 '22 23:10

Brian Campbell