Skip to content

Instantly share code, notes, and snippets.

@todgru
Last active December 12, 2019 19:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todgru/4313076 to your computer and use it in GitHub Desktop.
Save todgru/4313076 to your computer and use it in GitHub Desktop.
git tag

#git tag

Think of a git tag as an alias to a sha1 or to a branch.

The Git Book on tagging says there are two main typs of tags, lightweight and annotated. Lightweight only records commit and tag. Annotated records who, what, when and where. Use annotated, -a.

List all tags:

$ git tag

To tag your current commit:

$ git tag -a <tag_name> -m '<message>'

To tage a previsous commit:

$ git tag -a <tag_name> -m '<message' <sha1>

git push doesn't push the tag names to the repo. To push all tags to the repo:

$ git push origin --tags 

Or individual tag:

$ git push origin <tag_name>

Delete tag localy:

$ git tag -d <tag_name>

Push deleted tag changes to repo:

$ git push origin :refs/tags/<tag_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment