Created
March 6, 2018 14:42
-
-
Save andreacioni/7c0d6a7eb689eacd62215c9f3161344b to your computer and use it in GitHub Desktop.
Checkout git repository to 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
#!/bin/sh | |
#From: https://addhewarman.com/2015/01/23/easiest-way-how-to-get-tag-from-remote-github-repository/ | |
LAST_TAG=$(git ls-remote --tags [email protected]:MY_REPOSITORY/"$MY_PROJECT".git | awk '{print $2}' | grep -v '{}' | awk -F"/" '{print $3}' | tail -n 1) | |
git checkout $LAST_TAG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment