n. m. could be an AI
n. m. could be an AI

Reputation: 119847

Tagging latest release?

We have a git repo used for development. From time to time we make releases, marked with tags. There's also an automated build system that we want to build the latest tagged release. Meanwhile commits are pushed as usual.

How do we mark the latest release so that the automated build can pick it up?

It is important that the automated system always picks the version from the same URL. Cannot use a script with describe or any other fetch-time method to resolve the latest tag.

The first idea is to use a specific lightweight tag like LAST_RELEASE and move it (delete and recreate?) every time a release is tagged. Another idea is to maintain a separate branch and keep its head in sync with the last release tag. Yet another idea is to use a branch, but instead of keeping it in sync using merges/rebases, just delete and recreate it for each release.

I don't particularly like either of these methods. Is there any established sane way to accomplish this?

Upvotes: 1

Views: 485

Answers (1)

Candy Gumdrop
Candy Gumdrop

Reputation: 2785

The best way is to use a branch. You should find that, if done properly, a stable branch should always move forwards without any rebasing / force pushing. Whenever you do a new release, you can checkout your stable branch and merge in your develop branch. And whenever you need to hotfix changes into new releases, you can add commits / merge branches into the stable branch, and then checkout your develop branch and merge in stable.

Have a look here for a commonly used branching model based around this idea. You should find that the master branch in this model is exactly what you need to keep track of the most recent release.

If you are unable to switch to a branching model like this, it would still be better to use branches. When you want to mark a new release, you checkout your repository to the desired release commit, and run git push -f origin release, which has the same effect as deleting and recreating the branch.

Tags are meant to always mark the same commit once they are created. Branches are meant to move forwards.

Upvotes: 1

Related Questions