Book Image

Git Best Practices Guide

By : PIDOUX Eric
Book Image

Git Best Practices Guide

By: PIDOUX Eric

Overview of this book

Table of Contents (12 chapters)

Using tags


Git has the option to tag a commit in the repository so that you find it easier. Most commonly, tags are used to mark an application version on a commit.

Creating and deleting tags

The command to create a tag is very easy:

Jim@local:~/webproject$ git tag 1.0.0
#Annotated tag contains a small description
Jim@local:~/webproject$ git tag 1.0.0 -m 'Release 1.0.0'
#Use a commit
Jim@local:~/webproject$ git tag 1.0.0 -m 'Release 1.0.0' commit_hash

Tags can also be deleted, but by default, it will only be inside your local repository. If you want to push the deleted one, you have to specify it. First, list all the available tags and delete the last tag:

Jim@local:~/webproject$ git tag 
0.1.0
0.1.5
0.2.0
0.9.0
1.0.0
Jim@local:~/webproject$ git tag -l 0.1.*
0.1.0
0.1.5
Jim@local:~/webproject$ git tag -d 1.0.0
#Push it remotely
Jim@local:~/webproject$ git push origin tag 1.0.0

As I said earlier, tags are commonly used to mark a state of a release. They are called release tags.

By convention...