Reputation: 6166
Our release branch TAG got into master after a merge in the wrong direction. We prefer not to keep TAGs on master. How do I just remove the TAG from master but keep the other file commits intact?
release master
| |[time now]
| |
| |
| |tag1(to remove)
| >merge> |
| |
|tag1 |
| |
| |[time before]
Upvotes: 1
Views: 1810
Reputation: 625
I think you have a wrong perception of tags in Git. Branches and tags are both simply pointers to commits. The difference between the two is, that branches can be changed, tags can not, i.e., branches are writeable, tags are read-only so to say.
Tags do not exist on any branch, since they are, like branches, simply pointers. For a better understanding on branches please refer to the simple diagrams in the Git Book: https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
When you create a tag, let's call it v1.0
it points to exactly one commit, let's say ba70138
, i.e., v1.0 --> ba70138
. This does not define whether or not this commit is reachable by any branch. It's the parent-child relations between commits which define the history. As soon as you merge your release branch to master
it contains commit ba70138
and therefore the tag v1.0
is reachable from master
.
See also documentation of git describe
:
git-describe - Describe a commit using the most recent tag reachable from it
Upvotes: 1