git branch - What happen to Git tags pointing to a removed commit -
say following:
- create branch
x
- create tag
t
(to branchx
) - push
- remove branch
x
what happen tag t
? floating there? considered garbage?
should remove tags pointing @ branch before removing branch itself?
reference
from git basics - tagging:
git uses 2 main types of tags: lightweight , annotated. lightweight tag branch doesn’t change – it’s pointer specific commit.
what happen tag t?
let's created branch x
commit e
, tagged commit tag t
. e.g.
x (branch) | v a-----b------c------d------e ^ | t (tag)
if remove branch x
nothing happens tag t
.
git branch -d x
the tag still points commit e
.
a-----b------c------d------e ^ | t (tag)
is considered garbage?
no, because commit still referenced tag t
.
what if commit removed?
you not remove commits. remove pointers commits , if commits no longer referenced git garbage collect them day (depending on configuration).
see git gc
even if removed ordinary refs, branches , tags, commits still referenced in reflog form time , can access them, e.g. create branch again, tag them or cherry-pick , on.
you can see reflog using git reflog
. take @ gc.reflogexpireunreachable
, gc.reflogexpire
Comments
Post a Comment