Last active
August 29, 2015 14:07
-
-
Save electblake/9a51bc86c0943fd1dd23 to your computer and use it in GitHub Desktop.
automatically generate RELEASE version and revision
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/bash | |
## Automatically generate RELEASE version and revision | |
## | |
## Example: | |
## Given a most recent tag of `0.0.1` in git, this hook maintains a file like `RELEASE` of contents `0.0.1.rev-94` | |
## Install: | |
## mv pre-commit.sh .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit | |
exec 1>&2 | |
revisioncount=`git log --oneline | wc -l` | |
projectversion=`git describe --tags --long` | |
cleanversion=${projectversion%%-*} | |
# VERSION="$projectversion.rev-$revisioncount" | |
VERSION="$cleanversion.rev-$revisioncount" | |
FOOTER='RELEASE' | |
echo $VERSION > $FOOTER | |
git add RELEASE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
given a most recent tag of
v0.0.1
in git, this hook maintains a file likeRELEASE
of contentsv0.0.1.rev-94