Reputation: 203
I'm currently trying to tag a git projects which same version tag for a release. The project is an extension for an exist product. For backward compatibility with the existing product, we needed to created two different versions of our project. So we created two branches named master (latest version of product) and productX.X (backward compatibility to product version X.X) which contain the different version releases of our product. We're merging the code from the branch master to the branch productX.X to keep the code in sync.
The number of branches will grow as we need to great a new version of our project when a new version of the product will be released.
Now, I want to release version 1.0.0 of our project for both product versions (latest and X.X). I read that I can use only once tag name for all branches. Is really not possible to tag different branches with the same tag "1.0.0"?
If it isn't possible what would be the good approach?
Alternative approach: Tag the branch "productversionX.X" with a postfix: master: 1.0.0 productversionX.X: 1.0.0-productX.X
I'm currently using Tower as git client and gitlab as git server.
Thanks Patrick
Upvotes: 16
Views: 12727
Reputation: 516
You can't.
tags are just nice names for the ugly git hashes. So a tag
to a <commit-id>
.
Upvotes: 7
Reputation: 11571
A Git tag points to exactly one commit, i.e. there's no such thing as per-branch tags. If you have different variants of the same base version (for example 1.0.0), using a special prefix or suffix as you suggested is a reasonable solution.
Depending on what type of differences there are between the branches it may make more sense to use static or dynamic configuration in the code to select between different behaviors. That would allow you to produce all variants of the product from a single commit and hence use the same tag for them all.
Upvotes: 19