Skip to content

Instantly share code, notes, and snippets.

@drewr
Created March 15, 2010 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewr/333247 to your computer and use it in GitHub Desktop.
Save drewr/333247 to your computer and use it in GitHub Desktop.
versionize() {
local file=$1
local ver=$(git log --pretty=format:"%ai %h" -1 | perl -p -e 's,(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d) [^ ]+ ([a-z0-9]+),\1\2\3\4\5\6+\7,')
local versionedfile=$(echo $file | perl -pe "s,(.*)\.([^.]+)\$,\$1-${ver}.\$2,")
cp $file $versionedfile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment