Last active
May 28, 2022 20:07
-
-
Save chainat/e2d4d806b8b1a3ddb6d5b8400e1e30ea to your computer and use it in GitHub Desktop.
Compact local git repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These two commands will minimise the diskspace used for the repo. Please note that Github, BitBucket run this all the time to minimise the diskspace. | |
Suggestion: Run as often as you can (i.e. once a week for small working-in-progress repo, one in every few days if many people work together). | |
It's no harm to run it often, cron or system task could be an option too. | |
# Clean unused commits | |
`git reflog expire --all --expire=now` | |
# Compact the disk by remove unneccesary files from the local git repository | |
`git gc --aggressive --prune=now` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment