Last active
May 4, 2020 17:05
-
-
Save cetver/83786476cfdbf05feae18938134ac675 to your computer and use it in GitHub Desktop.
git checkout last tag
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
#!/usr/bin/env bash | |
set -eo pipefail | |
rep_url="https://github.com/nvm-sh/nvm.git" | |
last_tag=$( | |
git ls-remote --tags --quiet --exit-code --refs --sort version:refname "$rep_url" | \ | |
tail --lines 1 | \ | |
sed --regexp-extended 's@.+refs/tags/@@' | |
) | |
echo "$last_tag" | |
git fetch --tags | |
git checkout tags/"$last_tag" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment