Tagging in Git

Tags are used to mark your code, likely branch names but the user can’t checkout tags. tags are just like versions of your code like v1,v2, v2.2, Creating a tag requires one parameter: the name of the tag
List all tags
Tag the latest commit
Create a tag called beta from the next to last commit
Delete your tag
caution
Tags cannot begin or end with /.
caution
You cannot use the characters ^, *, or: inside tags
There are two types of tags
- Annotated tags
- Lightweight tags
Annotated tags
annotated tags are useful when you release project publicly, annotated tags contain metadata kike tag message, timestamp, authour name, release notes etc, these are useful for releasing your project publicly because visitors or other unknown user are able to know the actual details and time stamp of the tag, annotated tags always point to a tag object in the git object database
Command to create annotated tag
the above command creates a LOCAL tag on the current branch,but when you push your latest commit to the remote repository, git doesn’t push tags user needs to push tags separately by command
Annotated tag example
In the above code -m is used to provide a message to the tag, if the user doesn’t use -m, git automatically opens the editor so user can type message
Lightweight Tags
lightweight tags are simple tags which will be used locally mostly, to create lightweight tags just don’t provide any additional parameters like -m,-a .lightweight tag is just a named pointer to the commit