Skip to content

Instantly share code, notes, and snippets.

@joelcox
Created May 11, 2011 08:12
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 joelcox/966096 to your computer and use it in GitHub Desktop.
Save joelcox/966096 to your computer and use it in GitHub Desktop.
Add commit hash constant
#!/bin/bash
# Append the latest commit hash to your PHP constants file after the Git repository received a push.
# Path to constants file
CONST_PATH = ../../application/config/constants.php
# Ask git for the last abbreviated commit hash
HASH = `git log -1 --pretty=format:"%h"`
echo define \(\'COMMIT_HASH\', \'$HASH\'\)\; >> $CONST_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment