Why would anyone mark in Git?

I met many developers who swear by gits. Personally, I have never seen its use.

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

I'm just confused by the fact that the tag value adds that the commit message cannot.

+6
source share
4 answers
Tags

allow you to reference a specific commit in the repository. Using, for example, the version tag, you can easily get a commit in your project that matches, for example, version 1.5. It is preferable to remember the hash of a particular commit or scroll / anti-aliasing through the log information to find out which commit represents version 1.5.

This can be useful for many reasons, but consider only one thing: you have two clients that run different versions of your software, client A in version 1.5 and client B using version 2.0 . Client A reports an error and you cannot just upgrade your installation and should instead address the error in version 1.5 code. The tag version 1.5 allows you to easily return to the code in which they work and work with the patch.

+8
source

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

Sometimes I add a local tag when I re-reference a specific version, for example, just before a lot of work. I also use annotated tags to mark a specific release version number (annotated tags can be easily ported and may contain an optional description other than the name).

+8
source

A commit message is usually used to get more information about why commit was made, rather than just β€œthis is version X”.

Using the tag, you can return to the marked version without scrolling through the log to find the correct commit number; you check the tagged version directly. And a more limited namespace for tags is an advantage here, not a hindrance.

+5
source

Please note that you can mark a tag , which is important when you want to click (i.e. post to another repo)

See β€œ Why some open source projects don’t accept download requests, but only send patch files by email .

So why would you mention in Git (distributed version control system)?

You can mark to refer to a tree with a symbolic name (as explained in other answers).

But you can also sign your tag to contribute to another repo, vouching for the integrity of the content.
The recipient only needs to make sure that the signature of the tag is in order to confirm that it is received from a reliable source.

+2
source

Source: https://habr.com/ru/post/919460/


All Articles