My employer likes to use version numbers in their branch names. I dislike having to remember and verify whatever the current number is. Is there a way to "tag" or alias their branch, so I can use a branch name which does not change?
For example, they like to use:
So it changes every release. I don't have any influence and the rest of the herd like it this way, so there is no point in telling me not to do that.
It would be nice if I could pull and push to "release/env-app", or "foobar" for that matter.
I can't actually 'git tag' because that refers to a specific commit, whereas this is constantly changing. Unless it is possible to tag the HEAD commit of a branch?
I can't actually 'git tag' because that refers to a specific commit, whereas this is constantly changing. Unless it is possible to tag the HEAD commit of a branch?
If you were to tag the head of a branch, you would still tag a specific commit (the branch's tip). Rather than a tag, you're looking for a sort of "branch alias".
To create an "alias" that always points to the tip of your release branch, you could define a symref. This would work exactly like the HEAD symref, which always points to the tip of the referenced branch, as a symref is simply implemented as a file containing the name of the branch it refers to.
You can create a symref with the plumbing command git symbolic-ref
.
git symbolic-ref refs/heads/foobar refs/heads/release/env-app-44-0-2
Like so, you could use foobar
to perform any operation (checkout
, rebase
, etc.) as if you were working with the env-app-44-0-2
branch. Then, once the next release branch is ready, you can update the symref with the new branch.
git symbolic-ref refs/heads/foobar refs/heads/release/env-app-44-0-3