What steps do I need to take to remove a git mirror?

I have cloned android and downloaded the full mirror to be able to quicker checkout with git clone --reference (With its wrapper repo init --mirror) but my mirror contains parts of the code which is not never referenced and too much disk space is wasted here. For instance I do not need to have the prebuilt binaries for MacOS and Windows when only building on Linux.

I see two possible paths forward please let me know in the comments if I should split this into two separate questions

Option 1: is to decouple the mirrors from all checkouts where the local git repo no longer uses the mirror but have everything contained in its own directories. I think maybe some command line for git fsck could be used for this.

I did not use --dissociate when creating to clone. Now I want to transform the shared objects to disassociated objects.

Option 2: find which modules in the mirror that is actually in use and remove any which does not have any links to it. This could probably be a job for find,grep and awk magic.

I would also like to run above without destroying my working directories just in case there is some change I have forgotten to commit somewhere.

0

There are 0 best solutions below