I initially made a git repo and uploaded large files to git LFS. Now I want to clean it and upload only a necessary few files to git LFS so that I don't exceed the quota.
So what I did is:
- Deleted all unnecessary files from my local git repo, added and commited.
- Deleted my remote repo completely and created an empty one (took a few minutes, but my LFS data shown in my git profile was successfully reduced).
- Changed my remote and tried to push to the empty repo, but the push tries to upload the same number of files to the LFS before the deletions.
Also tried git lfs prune
but it seems to be keeping everything.
Even though I commited after the deletions, all these large files seem to still keep getting referenced and uploaded on push to the new empty repo. Desired result is to only upload to LFS the few large files that have remained in the project.
CodePudding user response:
I the lfs tracked files are in the git history at any point those will be pushed. Even if not are present in last commit.
So it very likely you will have to rewrite git commit history:
Either by rebase (git rebase --interactive <commit before files were include>
) or if it is too old in git history using filter-branch
You could search which commits still refer to that file with:
git log --all --full-history -- "*<files names were tracked with lfs>.*"