Skip to content

Instantly share code, notes, and snippets.

@mrmans0n
Created April 25, 2012 18:51
Show Gist options
  • Save mrmans0n/2492210 to your computer and use it in GitHub Desktop.
Save mrmans0n/2492210 to your computer and use it in GitHub Desktop.
Obtain some cool information about git from a Rails application
GIT_BRANCH = `git status | sed -n 1p`.split(" ").last
GIT_COMMIT = `git log | sed -n 1p`.split(" ").last
GIT_REVISION = `git log --pretty=format:'%h' -n 1`
GIT_LASTUPDATE = `git log -1 | sed -n 3p`.split(" ").slice(1,5).join(" ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment