How do you free up disk space after adding an alternative to git?

I have a git working directory and added it to .git/objects/info/alternates , so this working directory does not need to store duplicate data that is already in another working directory on my machine. (This is what git clone --reference=DIRECTORY does). However, duplicate objects already stored in the working directory are not deleted from my .git/ directory. This means that the .git/ directory remains large.

How to get rid of duplicate objects, so the .git/ directory is smaller?

+7
source share
1 answer
 git repack -adl 

The -l option, in particular, skips objects borrowed from the alternative. See git help repack and git help pack-objects .

+9
source

All Articles