Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get rid of "Lost heads"?

Tags:

git

smartgit

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.

like image 686
Bulwersator Avatar asked Feb 23 '13 19:02

Bulwersator


1 Answers

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.

like image 167
mstrap Avatar answered Nov 06 '22 05:11

mstrap