- add filter
$ git config filter.nocache.smudge "perl -pe 'BEGIN {\$h = \`git log --pretty=format:\"%H\" -1\`; } s{\\?[A-z0-9]*#cache-bust}{?\$h#cache-bust}g'"
$ git config filter.nocache.clean "perl -pe 's{\\?[A-z0-9]*#cache-bust}{?nocache#cache-bust}g'"
- edit .gitattributes
*.html filter=nocache
and this <link media="all" href="/css/main.css?nocache#cache-bust" type="text/css" rel="stylesheet">
on checkout will be transformed into something like this <link media="all" href="/css/main.css?a761f5f48b8d7389069982d82a6c945fddd687a9#cache-bust" type="text/css" rel="stylesheet">