views:

83

answers:

2

I've got an annotated tag refering to a commit (does it matter if it is annotated?) and no branch refering there. Will the commit be garbage collected after some time?

+4  A: 

No, the commit will not be garbage collected. A reference from a tag is sufficient to keep a commit alive.

Greg Hewgill
Is this documented in the git manual?
Adrian Panasiuk
The git-gc documentation at http://www.kernel.org/pub/software/scm/git/docs/git-gc.html mentions this under the Notes section. "it will keep not only objects referenced by your current set of branches and tags..."
Greg Hewgill
+4  A: 

tags and branches are both refs, if a ref is pointing to a commit, it's not garbage collected. You can also have custom refs, but those are uncommon.

felipec