I have a Git command alias to checkout the latest tag from a repository:
~/.gitconfig:
checkout-latest = !git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
So I can use it in properly tagged repositories like this:
$ git checkout-latest
I have command aliases for the checkout command:
~/.gitconfig:
co = checkout
The checkout-latest does not work with the command aliases for checkout:
$ git co-latest
git: 'co-latest' is not a git command. See 'git --help'.
How can I configure Git so that I can use latest as a tag alias that points to the programmatically determined latest tag? I would like to use it like this:
$ git checkout latest
and
$ git co latest
Note that there is no dash between the subcommand and the tag in my desired variants.
Git aliases cannot reference other aliases.
You can accomplish this with another layer of indirection, however: