Search code examples
version-controlgithubtags

How to create a github release with an annotated tag?


I've created a release on github, but it seems to be a non-annotated tag. Anyone know how to make an annotated tag along with a release? Is it OK to just replace the tag with an annotated one -- will it still work?


Solution

  • Annotated tags are created using the -a flag.

    The difference between regular tag to annotated tag is that the annotated tag is like a commit, it contain the date, author and the message attached to it.

    Once you create the tags simply push it to the github repository
    git push --tags. Since tags are simply a pointer to a given commit you can "move" them between commit.

    Creating annotated tag

    git tag -a <tagname>

    Moving an existing tag

    git tag -a <tagname> <SHA-1> -f

    Pushing the tags

    git push origin --tags -f

    The important thing is the -f (force) flag