Search code examples
gitgit-tag

Create an annotated git-tag with a particular tagger-name, tagged-date


How to create an annotated git-tag with a particular tagger-name, tagged-date?

The docs how to make it right have no such info.

From another stackoverflow question:

git config --global user.name "John Doe"
git config --global user.email [email protected]
git tag <tag-name> [commit]
git push origin <tag-name>

I have to redefine global config settings - well this is clearly not a good way


Solution

  • The simple and CORRECT solution would be:

    $ git mktag <tag-file >output
    

    tag-file:

    object <HASH>  # hash of the commit we are want to set tag to
    type commit
    tag <NAME>  # name of the tag
    tagger Bob Dylan <[email protected]> 1484015966 +0000
    
    Message
    

    output:

    <HASH>  # hash of the created tag
    

    after:

    $ git update-ref refs/tags/<NAME of the created tag> <the HASH from output file>