For a project, say I have some release branches:
release/1.2
release/1.1
release/1.0
These release branches are based on the minor version. Because they keep being supported, each of them will be at a different patch version, stored somewhere in some build configuration file (gradle in my case). For example:
release/1.2
build.gradle contains "version 1.2.1"
release/1.1
build.gradle contains "version 1.1.4"
release/1.0
build.gradle contains "version 1.0.7"
Now, suppose I fix a bug in branch release/1.0
. Then I'd like to merge this branch to the next two, to propagate the fix. In general, this would work quite smoothly.
However, when fixing the bug in release/1.0
I would also want to bump its patch version, from 1.0.7 to 1.0.8, changing the file build.gradle to contain "version 1.0.8". But if I do that, the merge into the next release branches will create a conflict on that file.
Obviously there must be a better way to support my initial intentions. What are the best practices in this case?
One way I could think of is to not store the full version in a file, but only use git tags, and then have gradle (or any other build tool) obtain the full version from the git tag. One major disadvantage of this approach is that the build would fail on a sourcebase that is exported from git.