0

I am new in learning git and I'm studying about tag in git I have read the commands related to tag but I wanna know what the usage of tagging in git is.

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
negar
  • 115
  • 2
  • 8
  • Here is IMHO is more relevant answers to that particular question than in suggested link: https://stackoverflow.com/questions/1457103/how-is-a-tag-different-from-a-branch-in-git-which-should-i-use-here – Alex Martian Dec 28 '18 at 11:40

2 Answers2

2

Technically a tag is just a "fixed" pointer to a given commit, with a (hopefully meaningful) arbitrary name.

It's used as a marker, for example to allow for meaningful diffs, or restore old versions of a codebase.

One common usage is to tag each release of an app. With a given naming convention, it allows one to very conveniently diff and answer questions like "What did we change in this part since release XYZ?".

And of course it makes patches easier than having to somehow find and store long-form commit hashes.

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
1

Git tags are majorly used for marking a particular milestone release of your code. One of the major use of git tag is to mark your release version. You would find all the code base to follow a particular pattern like, v3.5.2

A typical format for any version release of any code is as follow.

(Major version).(Minor version).(Revision number).[(Build number)optional]

Where Major version means that the some of the previous code might break which is mentioned on the release note.

Minor version when there is a major bug fix or an optimisation or a new functionality is introduced in the library

Revision number majorly when you have to fix a small bug which is affecting the current users, kind of a quick patch

Build Number is pretty much used internally before the code is released. Like alpha , beta, beta-1 , RC or Release candidate.

A good example would be this release history

Now a days few organisations have started to adapt a new convention which depend on the date of release.

Year.Month.Day.Build

That's pretty much what people use git tag in the industry.

But you are free to use it your way. If it is an hobby project, then you can use git code to mark your milestones, say UIv1.0 which might mean this release has your first UI.

Arghya Saha
  • 5,599
  • 4
  • 26
  • 48