I'm working with Unreal Engine 4 and it serializes all its asset files as binary files. Currently, the project size is less than 10MB but the .git folder is almost 700MB.
I have LFS tracked all asset files and did an lfs migrate
on the repo, but the repo is still big. GitHub says files are in LFS but I didn't see my LFS storage usage meter go up after pushing the rewritten history.
I'm not sure if this is the way LFS works but as I understand it Git will store a pointer to the file in LFS and only download the version of the file from the commit your HEAD is at.
I'm pretty lost here. I think it's worth mentioning I'm kind of a newb in git so please go easy on me.
Thanks in advance.
EDIT:
I ran git lfs install --skip-smudge
and then cloned the repo, this made the repo folder a lot smaller since no LFS files were downloaded when cloning. The problem is that now I only have the pointer files and doing a git lfs pull
fails to check out all files. Error message is Could not check out "<file-name>"
.
Git LFS will keep the versions of the files in recent commits. Here, 'recent' means the value of lfs.fetchrecentrefsdays
configuration property. So LFS will pull all versions that are 7 days or newer (this is the default value, but you can change it).
To remove all old files you need to git lfs prune
. A prune will remove all file versions that are older than lfs.fetchrecentrefsdays
+ lfs.pruneoffsetdays
. lfs.pruneoffsetdays
defaults to 3 and lfs.fetchrecentrefsdays
defaults to 7 so when a prune is run all versions older than 10 days will be removed.
More info here
EDIT: as for the "Could not checkout file" error I was getting, a clean install of Git did the trick.
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