28

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?

Karol
  • 1,246
  • 2
  • 13
  • 20
  • 1
    Found the answer to the second part of my question here: http://stackoverflow.com/questions/5002555/can-a-lightweight-tag-be-converted-to-an-annotated-tag – Karol Feb 11 '14 at 00:07
  • I assume you would be able to create an annotated tag from the command line, and then push it (with `git push --tags`) to GitHub, where you could continue to edit it. – Nick McCurdy Dec 28 '14 at 05:51
  • @NicolasMcCurdy Yes, see the link in my previous comment. – Karol May 14 '15 at 15:50

1 Answers1

9

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

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • 6
    Don't forget the tagname ```git tag -a ``` – Joris Sep 19 '15 at 13:35
  • This doesn't work for me - I pushed 2 annotated tags, but an older tag still shows up as "latest release" at https://github.com/:user/:repo/releases – dcorking Apr 06 '18 at 07:59
  • I found out why - as well as pushing the tag, I need to use the Web UI to 'Draft a release' as described in https://stackoverflow.com/a/18512221 – dcorking Apr 06 '18 at 09:29