Skip to content

Instantly share code, notes, and snippets.

@VikashSaharan1
Last active July 15, 2020 04:52
Show Gist options
  • Save VikashSaharan1/582f90ed9548cc5b75a593e6455fac29 to your computer and use it in GitHub Desktop.
Save VikashSaharan1/582f90ed9548cc5b75a593e6455fac29 to your computer and use it in GitHub Desktop.
Git Tagging Information

How to add Git Tagging of your repo

Listing Your Tags

C:>repo_path>git tag --list or C:>repo_path>git tag -l

Creating Tags

Git supports two types of tags: lightweight and annotated.

1. Lightweight Tags:-

      A lightweight tag is very much like a branch that doesn’t change — it’s just a pointer to a specific commit.

2. Annotated Tags :-

      Annotated tags, however, are stored as full objects in the Git database. They’re checksummed; contain the tagger name, email, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG).
Creating Tags
      Creating an annotated tag in Git is simple. The easiest way is to specify -a when you run the tag command:
      C:\>repo_path>git tag -a v1.0 -m "App  Version 1.0"
      The -m specifies a tagging message, which is stored with the tag. 
Showing Tags Info
      You can see the tag data along with the commit that was tagged by using the git show command:
      C:\>repo_path>git show v1.0
Pushing Tags
      C:\>repo_path>>git push origin v1.0
Pushing Multiple Tags
      C:\>repo_path>git push origin --tags
Delete Tags
     To delete a tag on your local repository, you can use git tag -d <tagname>. For example, we could remove our lightweight tag above as follows:
      C:\>repo_path>git tag -d v1.0
      
     Note that this does not remove the tag from any remote servers. There are two common variations for deleting a tag from a remote server.
Deleting Remote Tag
     C:\>repo_path>git push origin --delete v1.0
Checking out Tags
     C:\>git checkout v1.0
     if you need to make changes — say you’re fixing a bug on an older version, for instance — you will generally want to create a branch:
     C:\> git checkout -b copyversion1.0 v1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment