3

I have a bare git repository that, according to git fsck --full, has about 300 dangling commits and tags. About 90% of it are dangling tags.

I'm not sure where these issues come from, but since the repository seems to work fine, they might have been there for a while already.

I would like to fix them, but so far nothing I tried made the issues go away. So far I have tried these commands:

git reflog expire --expire=now --all
git gc --prune=now --aggressive
git repack -a -d

How can I fix these dangling commits and tags? Are they a problem at all? It is important that I don't lose the history and tags and I'm a bit concerned about the many dangling tags.

Best regards

2

1 Answer 1

0

Dangling commits and tags are commits and tags which are not "reachable" which means that they are not the part of the history of HEAD or any branch. If and only if you currently do not miss any commit, then you can remove them. To delete dangling commits, DrZoo has already posted a good link. Deleting tags using git can be a little bit tricky sometimes. But You can also remove tags manually. If git says you have a

dangling tag b61fdaf08acb1412b629b1913da21143775e523a

for example then you can remove this by removing the file

repositoryfolder\.git\objects\b6\1fdaf08acb1412b629b1913da21143775e523a

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.