Search code examples
githubtagging

How do I add a tag to a Github commit?


When making a GitHub commit, how do I tag it using the git command-line options before pushing it to remote repo?

Can something like this be done? git commit -m 'first commit' -tag -a v0.0.1 -m "1st release"


Solution

  • AFAIK, you cannot commit & tag in one command.

    git commit -m "prepare for v1.0.0 release"
    git tag v1.0.0
    git push origin master --tags
    

    All you can do is connect commands via &&:

    git commit -m "prepare for v1.0.0 release" && git tag v1.0.0 && git push origin master --tags