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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With