I want to display the hash of the current git commit in the browser so that testing team (which does not have an access to run heruko commands) will be able to include the c
Both culix and joshwa have great answers. If you name your heroku git remotes the same as your corresponding heroku apps you can have an even shorter and more robust .git/hooks/pre-push
hook:
#!/bin/bash
remote="$1"
url="$2"
if [[ $url =~ heroku ]] ; then
hash_name=COMMIT_HASH
hash=$(git rev-parse HEAD)
echo Setting $hash_name to $hash on app $remote
heroku config:set $hash_name=$hash --app $remote
fi
exit 0