Search code examples
gitgit-tag

See who deleted git tag


Is it possible to find who deleted a git tag from a repository?

Suppose you have a repository with contributors. The repository has the dev tag and versions: v0.1.0, v0.1.1 etc.

Someone deletes a tag. How would you find who deleted the git tag?


Solution

  • You have two types of tags:

    • lightweight
    • annotated

    The lightweight tags are only metadata for a commit. They have no author by themselves. Saying that the author of a tag is the author of the commit is wrong, since anyone else could have tagged that commit with a lightweight tag.

    The annotated tags are on the other hand like commits. That is why the annotated tags also need a message when you create them. They have an author, description, etc.

    So, to know the authors of your tags, you must have an annotated tag policy. But, from what I know there is no history of a git repo metadata (.git directory). This means you cannot know who deleted a tag/branch/etc, unless your git provider has a mechanism to audit/log/this.