Skip to content

Instantly share code, notes, and snippets.

@csmr
Created February 12, 2017 21:14
Show Gist options
  • Save csmr/c2ce09d01568e3c3dcedc563ad6cc8bf to your computer and use it in GitHub Desktop.
Save csmr/c2ce09d01568e3c3dcedc563ad6cc8bf to your computer and use it in GitHub Desktop.
Cachebusting string / version string insertion
I. Some version string
Using clean/smudge filter script
https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes
Versuiob tagging
http://softwareengineering.stackexchange.com/questions/141973/how-do-you-achieve-a-numeric-versioning-scheme-with-git
Heahd shrot hash
git rev-parse --short HEAD
http://stackoverflow.com/questions/1274605/ruby-search-file-text-for-a-pattern-and-replace-it-with-a-given-value
II. Replace param-placeholder in files
http://stackoverflow.com/questions/525592/find-and-replace-inside-a-text-file-from-a-bash-commandhihh
sed -i -e "s/_version_hash_str_/$(git rev-parse --short HEAD)/g" /tmp/tstex.txt /tmp/another.file
III. Rename files
? mv $F ${F%.*}-$D.${F##*.}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment