Skip to content

Instantly share code, notes, and snippets.

View atrauzzi's full-sized avatar

Alexander Trauzzi atrauzzi

View GitHub Profile
@ericbmerritt
ericbmerritt / gist:4013729
Created November 4, 2012 20:53
A script to generate a valid semver version in any git repo
#!/bin/bash
#
# If run inside a git repository will return a valid semver based on
# the semver formatted tags. For example if the current HEAD is tagged
# at 0.0.1, then the version echoed will simply be 0.0.1. However, if
# the tag is say, 3 patches behind, the tag will be in the form
# `0.0.1+build.3.0ace960`. This is basically, the current tag a
# monotonically increasing commit (the number of commits since the
# tag, and then a git short ref to identify the commit.
#