git branch - What happen to Git tags pointing to a removed commit -


say following:

  1. create branch x
  2. create tag t (to branch x)
  3. push
  4. 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

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -