Skip to content

Instantly share code, notes, and snippets.

@mhahl
Created September 2, 2014 23:15
Show Gist options
  • Save mhahl/c5dbe7baa7866bb798df to your computer and use it in GitHub Desktop.
Save mhahl/c5dbe7baa7866bb798df to your computer and use it in GitHub Desktop.
# From http://stackoverflow.com/questions/4120001/what-is-the-git-equivalent-for-revision-number
# $ git_rev
# 2:0f8e14e:20130220
#
# commit_count:last_abbrev_commit:date_YYmmdd
#
git_rev ()
{
d=`date +%Y%m%d`
c=`git rev-list --full-history --all --abbrev-commit | wc -l | sed -e 's/^ *//'`
h=`git rev-list --full-history --all --abbrev-commit | head -1`
echo ${c}:${h}:${d}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment