thehowler
thehowler

Reputation: 113

git - Is it safe to delete a branch which has a tag based on a merge commit?

Let's say that I peform a non-fast-forward merge from branch a to branch b. This means that b is now 1 commit ahead of a i.e. the merge commit. I then tag this merge commit. Then I delete branch b.

Why is it that my tag is still available? Will it disappear at some point in the future via garbage collection?

Upvotes: 1

Views: 1276

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 21998

"Why is it that my tag is still available?"

Tags don't need to be referenced by a branch to be kept around.

"Will it disappear at some point in the future via garbage collection?"

No, the tag is a permanent reference and any commit reachable through the tag will also be kept from garbage collection.

This is one of the main features of a tag.

Upvotes: 2

Related Questions