threads / discuss / 26355

Why git tags are there in git?

Subject: Why git tags are there in git?

## tl;dr

5 messages between Jan 28, 2011 and Jan 29, 2011.

replies: 4people: 5as markdown or json

vikram2rhyme· Jan 28, 2011, 11:37 UTC · lore

Hello friends I am wondering why the tags are there in git. As they are just pointer to the commit we can refer those commit by SHA sum only then why tagging? Moreover a commit can be tagged more than once that result in multiple tags pointing to the same point in the history. Is this a design flaw?

-- 
View this message in context: http://git.661346.n2.nabble.com/Why-git-tags-are-there-in-git-tp5969544p5969544.html
Sent from the git mailing list archive at Nabble.com.
L. Alberto Giménez· Jan 28, 2011, 12:27 UTC · re: vikram2rhyme · lore

Re: Why git tags are there in git?

On 28/01/2011 12:37, vikram2rhyme wrote:
Show 5 quoted lines
>
> Hello friends
> I am wondering why the tags are there in git. As they are just pointer to
> the commit
> we can refer those commit by SHA sum only then why tagging?
Hi, I tend to find easier "release-v1" than 2cff0e391ab127ae...

Regards, L. Alberto Giménez

Gabriel Filion· Jan 28, 2011, 15:03 UTC · re: L. Alberto Giménez · lore

Re: Why git tags are there in git?

On 11-01-28 07:27 AM, "L. Alberto Giménez" wrote:
Show 9 quoted lines
> On 28/01/2011 12:37, vikram2rhyme wrote:
>>
>> Hello friends
>> I am wondering why the tags are there in git. As they are just pointer to
>> the commit
>> we can refer those commit by SHA sum only then why tagging?
> 
> Hi, I tend to find easier "release-v1" than 2cff0e391ab127ae...
> 

In general, tags are used for marking a point in time. That marker won't move, whereas branches can move with time.

For example, in most projects tags are used to make it easier to refer to commits that mark official releases. In git.git (git's own repository), the tag v1.7.3.5 points to the release with the same number.

-- 
Gabriel Filion
Konstantin Khomoutov· Jan 28, 2011, 16:06 UTC · re: vikram2rhyme · lore

Re: Why git tags are there in git?

On Fri, 28 Jan 2011 03:37:56 -0800 (PST) vikram2rhyme <vikram2rhyme@gmail.com> wrote:

Show 7 quoted lines
> I am wondering why the tags are there in git. As they are just
> pointer to the commit
> we can refer those commit by SHA sum only then why tagging? Moreover a
> commit can
> be tagged more than once that result in multiple tags pointing to the
> same point in the history.
> Is this a design flaw?

Amending what other commenters said, I should note that beyond regular tags which just provide human-readable names to objects, there exist so-called "annotated tags" which are tags with descriptive messages contained in them, which can be used as a side-channel to provide additional information for commits, and also to digitally sign a line of history to which such a tag is attached.

Also note that a tag can be attached to any object in a Git database, not necessarily to a commit. This can be occasionally useful.

Enrico Weigelt· Jan 29, 2011, 17:17 UTC · re: vikram2rhyme · lore

Re: Why git tags are there in git?

* vikram2rhyme <vikram2rhyme@gmail.com> wrote:
Hi,
Show 5 quoted lines
> I am wondering why the tags are there in git. As they are just
> pointer to the commit we can refer those commit by SHA sum only
> then why tagging? Moreover a commit can be tagged more than once
> that result in multiple tags pointing to the same point in the history.
> Is this a design flaw?
No, it's an important design aspect.

Tag references (not to be mixed up w/ tag objects) are very useful to add a conveniently named pointer to some object (not necessarily a commit), so humans as well as programs can easily find them.

For example, in my OSS-QM repositories [1], I have some robots importing releases (sometimes from upstream's git repos, sometimes from foreign VCSs, tarballs or even distro packages) and tag them into a normalized namespace, so automatic systems (eg. my Briegel buildsystem) can easily fetch sourcetrees from there w/o further manual tweaking.

cu
[1] http://www.metux.de/download/oss-qm/normalized_repository.pdf
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 phone:  +49 36207 519931  email: weigelt@metux.de
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------

← back to recent threads