Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should someone tag in Git?

I've met a lot of developers that swear by tagging gits. Personally, I have never seen the use in it.

I understand that you can put version information in a tag, but why not just put that information in the commit message?

I'm just confused about what value the tag adds that the commit message cannot.

like image 995
Jonathan Avatar asked Jul 01 '12 23:07

Jonathan


People also ask

What does tagging a commit do?

A tag has a similar meaning in Git and GitHub. Tags help in identifying different commits that are important enough to be recognized or be noticed. For example, tagging a commit with release version 3.0 means that commit was the final commit before the launch of the 3.0 version of the software.

What does tag mean in GitHub?

About tags in GitHub DesktopTags are associated with commits, so you can use a tag to mark an individual point in your repository's history, including a version number for a release. For more information about release tags, see "About releases."

How do I tag someone in git?

Mention a GitHub user in a comment:Create your comment or issue, as described previously, and then in the comment text box, type @, followed by the user or team name, within the comment.


2 Answers

Tags allow you to reference a specific commit in the repository. Using for instance a version tag, you can easily get the commit in your project that corresponds to e.g. version 1.5. This is preferable to remembering the hash of a specific commit, or scrolling/greping through log information to find out which commit represents version 1.5.

This could be useful for many reasons, but consider just one: you have two clients running different versions of your software, client A at version 1.5 and client B using version 2.0. Client A reports a bug, and you can't just upgrade their install and instead need to address the bug in the version 1.5 code. Tagging version 1.5 allows you to easily get back to the code that they're running and work on a bugfix.

like image 146
pb2q Avatar answered Sep 20 '22 16:09

pb2q


In Git, a tag lets you assign a symbolic name (something that is easy to remember) to a specific commit. This allows you to refer to that commit by name, instead of by raw commit id.

I sometimes add a local tag when I'm repeatedly referring back to a specific version, such as a point just before a lot of work was done. I also use annotated tags to tag a specific release version number (annotated tags can easily be pushed and can contain additional description other than just a name).

like image 45
Greg Hewgill Avatar answered Sep 23 '22 16:09

Greg Hewgill