59 points · by andrewvc · 15y ago · 24 comments
#!/bin/sh
git-diff `curl -s "http://www.yourapp.com/_revision"`
Get your paths squared away, chmod +x it, then type in: git diff-prod
And boom! Instant diff with head in production.Of course, you might want to get your deploy scripts squared away for figure out why your servers aren't restarting if thats the reason for this.
It's actually really useful when coupled with Rails+Unicorn w/ downtimeless deploy. Every once in a while unicorn will run a deploy but stop picking up code changes, and this is a good way to verify that your deploy didn't go all the way through.
Additionally, it integrates with shell scripts easier than most other solutions. Lastly, if you really want you don't need to make it an HTTP header, you can just make a special /git_sha page that renders it out if you're really worried.
Additionally, GIT_SHAs are good for cache busting in some situations (though totally inappropriate for others).
does not work with heroku since they strip the .git folder... we should probably add that to the readme
[1] They could still exist for hints or what not, but I presume reasonably advanced caches will be able to heuristically figure out how long the content lasts and do things like start sending results while waiting on the header to return... with some sort of reset if it turns out to be a bad cached result.
(honestly I had never even heard of it before just now).
http://code.google.com/webtoolkit/doc/latest/DevGuideCompili...
I'm surprised i don't see this type of thing more often in other libraries.