+2

show all tags for a certain branch

UserXYZ 3 years ago updated 3 years ago 6

Just like for branches, need to see what tags exist for a certain branch, so you can add a new one before/after some changes in that branch.

Could you please describe in more details what exactly you mean? Note, that branches and tags in Git are just named pointers to commits. They are not part of commits.

Well, it's simple...I'll try to explain with an example:

Let's say I have two branches of my code, one is production and one is devel.

I mark every important stage in production with tags, like revisions, so after I create a first usable "product" with defined features, I call it V1.0 and tag it like that.

Then I start a devel branch to fix bugs for some time, and that code is related only to V1.0 and gets merged with production V1.0.

If enough bugs are fixed, I add another tag at production, such as V1.1, V1.2 etc...or maybe if I add some small improvements, features which are closely related to already existing V1.0.


Then I choose to add some major improvements and features, therefore starting V2.0 of production.

For that, I create another devel branch and merge new code to production with the tag V2.0. So I add one by one feature from devel to production, and each time I increase the revision, from V2.0 to V2.1 etc.


Finally, when I have functional product V2.x, I only fix bugs etc, like before, and for every large enough set of bug fixes and small changes I increase tag number in production, so before I start working on another big revision V3.0 i end up with a code in production on revision(tag) V2.7 for example...


So, I see a tag as a logical set of a bunch of commits that are a major step in already existing code line, so I would know what I have been doing without a need to go through all the commits to find out which one best describes all the changes I did.


Unfortunately, I don't see a way to get all the tags for a certain branch that would show me what each revision had, feature-wise, and that's why I asked if tag list/history could be implemented for a branch.


So speaking in Git terminology you want to get a list of all tags that point to some commit of the current branch's history?

Well, not to some commit but to all commits that have tag attached to them, only for a certain branch...if I understand correctly how this all works.

I do understand that branches and tags are just references to a certain point in time/commit in git history but just like I can see all branches, I would like to see all tags for a branch - so if I continue working on a branch after a pause, vacation for example, I can find out what was the latest revision(tag) so I can continue naming(tagging) further code changes.

I'm not sure I understand what you want. What do you mean with "just like I can see all branches" - where do you can see all branches for a branch?

git branch show all branches locally, and git remote show origin would show all remote branches and all local branches (with other info).

So, in a similar way, I'd like to say something like git tags show branch and get all tags for branch.

Also git tags set branch tag would set tag for a branch.


Of course, these commands do not exist but something along that line would be nice...