Skip to content

Instantly share code, notes, and snippets.

@alexford
Created December 11, 2012 20:54
Show Gist options
  • Save alexford/4262041 to your computer and use it in GitHub Desktop.
Save alexford/4262041 to your computer and use it in GitHub Desktop.
Quick way to include Git branch/commit info on PHP page
<strong>Branch: </strong><?=shell_exec('git rev-parse --abbrev-ref HEAD')?><br/>
<strong>Commit: </strong><?=shell_exec("git log -1 --pretty=format:'%h - %s (%cn, %cr)' --abbrev-commit")?>
@alexford
Copy link
Author

Sample output

Branch: development
Commit: 83f7383 - Better instance info in footer (shows branch and last commit) (alexford, 3 minutes ago)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment