Skip to content

Instantly share code, notes, and snippets.

@inouire
Created January 27, 2022 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inouire/fa7210b7d6c3fdb3ffe190f0c82bab95 to your computer and use it in GitHub Desktop.
Save inouire/fa7210b7d6c3fdb3ffe190f0c82bab95 to your computer and use it in GitHub Desktop.

Limit disk space used by Git

Short on disk space ? Using Git?

$ git fetch --all --prune
$ du -sh .git && git gc --aggressive && du -sh .git
13M     .git
Enumerating […]
6.5M    .git

Drop all removed upstream branches. You may check if you want to keep them, they are still listed as dangling commits by git fsck before you git gc. Compress the repository and see how much it worked ; can be up to 50%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment