TrustID icon indicating copy to clipboard operation
TrustID copied to clipboard

Consider cleaning up the .git folder to reduce the large repo size

Open kmilodenisglez opened this issue 3 years ago • 3 comments

Hi. I just cloned this repo and it ended up being 63.7MB. The biggest file is a 63.3MB pack in .git/objects/pack.

To see the 10 biggest files, run this from the root directory:

$ git verify-pack -v .git/objects/pack/pack-323d180074a64abef2844ad9a64f7c72d8a67d1a.idx | sort -k 3 -n | tail -10 To see what each file is, run this:

$ git rev-list --objects --all | grep [first few chars of the sha1 from previous output]

ex: $ git rev-list --objects --all | grep 676ab14f0f5878612078764e705f132181a90364

Most of the files are dependencies of fabric-chaincode/vendor and trustid-sdk/node_modules that were included by mistake in some initial commit. The next step would be to clean up your git by removing all of those unnecessary files.

One option is to use the bfg-repo-cleaner tool. In all these steps bfg is an alias for java -jar bfg.jar

step 1, clone a fresh copy of your repo, using the --mirror flag: $ git clone --mirror https://github.com/hyperledger-labs/TrustID.git

step 2: $ bfg --delete-folders "{vendor,node_modules}" TrustID.git

step 3: cd Trust.git git reflog expire --expire=now --all && git gc --prune=now --aggressive

Then verify: git count-objects -v

Finally, once you're happy with the updated state of your repo, push it back up (note that because your clone command used the --mirror flag, this push will update all refs on your remote server): $ git push

to know more about this issue:

https://git-scm.com/book/es/v2/Los-entresijos-internos-de-Git-Los-objetos-Git https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery https://github.com/18F/C2/issues/439

kmilodenisglez avatar Mar 08 '21 14:03 kmilodenisglez

Hi @kmilodenisglez, I have tried but i couldn't. Could you create a pull request fixing the issue? Best

mtnieto avatar May 19 '21 07:05 mtnieto

Buenas @mtnieto, por desgracia no puedo hacer un pull request por que estas modificaciones son sobre el historial del repositorio de Git de TrustID que se almacena en el .git, y no se reflejan en un pull request.

Por lo que necesito ser colaborador para poder hacer esos cambios. Por eso te envio un doc con los 7 pasos que debes realizar, estan muy bien explicado y comprobados por mi ahora mismo, cualquier cosa me dices!!!

Saludos!! Pasos.docx

kmilodenisglez avatar May 21 '21 16:05 kmilodenisglez

Hola @kmilodenisglez yo tampoco puedo, repliqué los pasos pero al hacer pull, al estar la rama master de este repo protegida no he podido. Todo hay que hacerlo por pull request.

mtnieto avatar Jun 01 '21 08:06 mtnieto