5

We have rather common Git workflow like it's described in this article. Now on our build server we would like to make build plans for develop, master and for the last release. The problem is that last release branch have different names in time (*release-**).

What are the ways to solve this problem? Is it possible to create alias with permanent name lastrelease that can be used by a build server? Anything else?

alexey
  • 8,360
  • 14
  • 70
  • 102

2 Answers2

2

If you got a natural ordering rule for your release-* tags name, you can list them and pick the last one.

For instance, this can be achieved this way :

git tag -l release-* | sort -V

-l option of git tag is to list tags matching the supplied pattern.

sort -V is a special numeric sort option designed for your case

If you wanna pick the last one just append tail -1 :

git tag -l release-* | sort -V | tail -1

If you want to get the last release of a subversion (for instance 1.x releases) it's pretty easy :

git tag -l release-1.* | sort -V | tail -1
p'tit fred
  • 191
  • 1
  • 4
1

It is possible to create refs that point to other refs, via the git symbolic-ref command.

However, this isn't necessarily intended behavior: What's the recommended usage of a Git symbolic reference?

Your other option might be to have HEAD of your master Git repository point at your latest release- branch, and then have the build server build HEAD, develop, and master.

A third option would be to simply have a release-latest branch, and use a post-receive hook to update it whenever your current release- branch is updated.

Community
  • 1
  • 1
Amber
  • 507,862
  • 82
  • 626
  • 550