Created
May 16, 2012 16:53
-
-
Save briandk/2712160 to your computer and use it in GitHub Desktop.
precommit hook for granovaGG git repository
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 | |
D=`date +%Y%m%d%H%M%S` # store the current system-clock as a date-stamp, down to the second | |
branch=`git status|grep -ie 'on branch master'` | |
if [ -z "$branch" ]; then # if the length of the string in variable "branch" is zero; | |
# or, in other words, if you're not on the master branch | |
cat DESCRIPTION | sed -e 's/^\(Version: [0-9]*\.[0-9]*\).*/\1.'$D'/' > DESCRIPTION.temp # cat the DESCRIPTION | |
# match on the version number | |
# append the full datestamp to the matched version number | |
# redirect the output to a temporary file | |
rm DESCRIPTION # trash the original DESCRIPTION | |
mv DESCRIPTION.temp DESCRIPTION # rename the temp file to DESCRIPTION | |
git add DESCRIPTION # stage the now-modified DESCRIPTION file | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment