tags in git

Tags can be used to record the milestones or important releases in Git history. There are 2 types of tags in Git.
  • Lightweight.
  • Annotated – In this type of tags, we can specify the author creating tags and also provide tag description.
Creating Lightweight tags Now let us see how to create a lightweight tag. Below command creates a simple tag.
 
git tag v1.1
To view all tags on current branch, you can use below command.
 
git tag
Creating Annotated tags Now let us see how to create a annotated tag. Below command creates a annotated tag.
 
git tag -a v1.3 -m “version 1.3”
We can also tag specific commit using below command
 
git tag -a v1.4 347dh82
We can push the tags to remote repository using below command.
 
git push origin v1.0
To check out specific tag in new branch, you can use below command. In below command, we are checking out tag – v1.0 to branch b4.
 
git checkout -b b4  v1.0
Here is the output of above example.


Complex problems, Simple Solutions