Andrei Herford
Andrei Herford

Reputation: 18745

How to tag/label commits of the same kind (e.g. bugfix, release, etc.) in git?

I am looking for a way to tag/lable/mark git commit of the same kind. For example when working on a new version typically multiple commits are added/created until the new version is finally released.

I know that I can create a tag to mark this commit for example as v1.2.3. However, this would be a specific tag for this specific commit which is not meant to be re-used on other commits. I am looking for a possibility to tag/label/mark all release commit with a common manner which and than use some command like show all release commits, show all bugfixes, show all new_feature_added, etc.

Currently I simply use the commit message to achieve this, e.g. New feature: Added xyz or BugFix: Fixed xyz. However, this is not the ideal.

Is this possible in git?

Upvotes: 0

Views: 739

Answers (1)

Pierre-Jean
Pierre-Jean

Reputation: 1994

Git tags, as you noted, are not meant to be shared across different commits, contrary to the common expected semantic of tags in other tools. Git tags are basically alias pointer to a specific commit.

You can use git notes for the purpose you mentioned.

You can use something like: git log --show-notes=bugfixes to show all commits matching the note bugfixes

Upvotes: 2

Related Questions