Tag

git tag assigns names to commits.

To demonstrate tags we prepare a repo:

$ git init

$ echo a-V1 > fileA.txt
$ git add fileA.txt
$ git commit -m "a-V1"
$ git tag V1.0
$ git push --tags

$ echo a-V2 > fileA.txt
$ echo b-V1 > fileB.txt
$ git add fileA.txt
$ git add fileB.txt
$ git commit -m "a-V2, b-V1"
$ git tag V2.0
$ git push --tags

$ echo a-V3 > fileA.txt
$ git add fileA.txt
$ git commit -m "a-V3, b-V1"
$ git tag V3.0
$ git push --tags

This is the history of commits:

$ git log --oneline --decorate
7f456ba (HEAD, tag: V3.0, master) a-V3, b-V1
96c9b28 (tag: V2.0) a-V2, b-V1
5e3d66a (tag: V1.0) a-V1

The tags can be used to display differences between the commits:

$ git diff V3.0 V2.0 fileA.txt
diff --git a/fileA.txt b/fileA.txt
index a8edb19..0b8ccf0 100644
--- a/fileA.txt
+++ b/fileA.txt
@@ -1 +1 @@
-a-V3
+a-V2

They can also be used to unroll to a commit:

$ git reset --hard V2.0
HEAD is now at 96c9b28 a-V2, b-V1

$ git log --oneline --decorate
96c9b28 (HEAD, tag: V2.0, master) a-V2, b-V1
5e3d66a (tag: V1.0) a-V1

Note to update the tags in the remote repo, one has to say:

git push --tags