We have a master
branch from which we periodically branch out ("cut") release branches. All the release branches are guaranteed to have the prefix release/
.
Suppose that at some time in the past we cut release branch release1
. A few commits are added to master
and now we want to cut release branch release2
.
Is there a way to retrieve the list of commits between those cuts? There might have been arbitrarily many commits, so simply doing a git log -10
to get the 10 latest commits will not quite do. I also don't have any guarantees about when exactly the last cut was made. I don't know if it happened yesterday, last hour, last year...
We are quite fortunate to be mechanically creating release branches through a dedicated Jenkins job that makes them in the format release/yyMMdd-HHmmss
. Consequently:
$ git fetch
$ LAST_RELEASE=`git branch -a | grep -E origin/release/[0-9]{6}-[0-9]{6} | sort | tail -1
$ git log $LAST_RELEASE..master
does the trick.