Skip to content

Instantly share code, notes, and snippets.

@kjantzer
Created March 2, 2015 20:01
Show Gist options
  • Save kjantzer/98dfa5138ad6e741c24f to your computer and use it in GitHub Desktop.
Save kjantzer/98dfa5138ad6e741c24f to your computer and use it in GitHub Desktop.
Get Previous Git Tag (the one before the latest tag)
# http://stackoverflow.com/a/28818420/484780
git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`
@roh85
Copy link

roh85 commented Sep 9, 2017

Just for reference but on windows this will be
git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1)

@jaymecd
Copy link

jaymecd commented Oct 10, 2017

@kjantzer & @roh85, u saved my day 👍

@dmytropetryk
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment