diff --git a/git-commands.js b/git-commands.js index 97c2a15..dce7b3d 100644 --- a/git-commands.js +++ b/git-commands.js @@ -5,8 +5,7 @@ module.exports = { * Returns latest tag, sorted by version or null if no tag was found */ getLatestTag: (prefix) => { - const maybeGrepCommand = prefix !== '' ? `| grep "^${prefix}"` : ''; - const stdout = exec(`git tag -l ${maybeGrepCommand} | sort -V | tail -n 1`); + const stdout = exec(`git describe --match="${prefix}*"`); const lastTag = String(stdout).trim(); return lastTag === '' ? null : lastTag; }