Last active
December 9, 2024 00:27
-
Star
(367)
You must be signed in to star a gist -
Fork
(59)
You must be signed in to fork a gist
-
-
Save rponte/fdc0724dd984088606b0 to your computer and use it in GitHub Desktop.
Getting latest tag on git repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The command finds the most recent tag that is reachable from a commit. | |
# If the tag points to the commit, then only the tag is shown. | |
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object | |
# and the abbreviated object name of the most recent commit. | |
git describe | |
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix: | |
git describe --abbrev=0 | |
# other examples | |
git describe --abbrev=0 --tags # gets tag from current branch | |
git describe --tags `git rev-list --tags --max-count=1` # gets tags across all branches, not just the current branch | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@fykaa No problem. I have a lot of GitHub Actions where I was using the GitHub API a lot to retrieve binaries. Maybe you will find them useful to look at as I was using regex to get the latest version.
https://github.com/eggbean/.dotfiles/tree/master/.github/workflows