github tag commit code example

Example 1: git commit and tag

git tag -a v1.0 7cceb02 -m "Your message here"

Example 2: git create tag and push

git tag -a v1.4 -m "my version 1.4"

Example 3: git add tag

git tag -a v1.2 
git push origin v1.2

Example 4: git create tag and push

$ git push origin v1.4
Counting objects: 14, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (14/14), 2.05 KiB | 0 bytes/s, done.
Total 14 (delta 3), reused 0 (delta 0)
To git@bitbucket.com:atlasbro/gittagdocs.git
* [new tag] v1.4 -> v1.4

Example 5: git tag from commit

$ git tag <tag_name> HEAD   (for the last commit)

Example 6: git commit and tag

git add .
git commit -m "some description"
git tag v0.1.9 # or any other text
git push origin master # push the commit
git push --tags origin # push the tags

Tags: