In my first attempt to do something with git I used GitHub for Windows. As it is simple and quite primitive tool I decided to try SmartGit. As I was looking around I discovered I have leftovers over my tests - something called "lost heads". How can I get rid of this garbage? It seemed that
git gc --prune=now
or something similar should work, but nothing changed. I tried googling, but everybody was trying to do reverse thing - restore lost commits from lost head or something similar.
According to the man page, git gc
will not garbage collect files which are referenced through the 'reflogs' (.git/logs/<ref-name>
files in your repository). These HEADs are exactly what SmartGit/Hg displays and when you remove these logs, the unreferenced commits should be collected by a git gc --prune=now
.
Warning Unless there is no really good reason to completely get rid of these commits (like removing sensitive data), you shouldn't do that -- maybe some time later your might be interested in exactly one of these commits. At least, reclaiming disk space is no good reason, in my opinion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With