We are using gitflow within my organization, particularly the concept of release branches. We also support multiple simultaneous release branches. A sample repo may look like so:
master -> a
\
\ c <-release/v1.0.0 e <-release/v1.1.0 g <-release/v1.2.0
\ / / /
develop-> b ---------------------d---------------------f
What I'd like to do is given a currently checked out release branch, find the predecessor release branch. For example:
-release/v1.2.0 is checked out, return release/v1.1.0
-release/v1.1.0 is checked out, return release/v1.0.0
-release/v1.0.0 is checked out, return nothing, there is no currently active previous release
We are using this to determine what files have changed between releases for deployment to a legacy system.
Assumptions: Release branches will always follow the format release/v.x.y.z
, where x,y and z are version numbers. Release branches are always organized sequentially based on these version numbers. v1.2.1 > v1.2.0
and v1.2.0 > 1.1.0
I considered using some combination of git branch --list -a *release/v*
to get a list of all release branches and some perl commands to sort through the results, but was wondering if there was some git commands along the vein of git rev-parse
or git rev-list
that could do it.
Notes: I am using z/OS USS ports of unix tools, git, bash, grep etc.