I am deploying my rails 3 app using capistrano, and I want to get the git version (and date information) and update my website\'s footer with this.
How can I do this? >
To people that doesn't use capistrano, a prettier one:
On config/initializers/git_info.rb:
GIT_BRANCH = `git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3`
GIT_COMMIT = `git log --pretty=format:'%h' -n 1`
GIT_COMMIT_TIMESTAMP = `git log --pretty=format:'%ct' -n 1`
The second one gives the sha in prettier form (ex: 4df21c0).
The third one returns the UNIX TIMESTAMP, that I format using Time/DateTime later.