Created
January 16, 2013 10:06
-
-
Save carcer/4546067 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_commit_hash_and_date | |
begin | |
commit = `git log -1 --pretty=format:%H` | |
git_date = `git log -1 --date=iso --pretty=format:%ad` | |
branch = `git rev-parse --abbrev-ref HEAD` | |
commit_date = DateTime.parse( git_date ).strftime("%Y-%m-%d %H%M%S") | |
rescue | |
commit = ENV["BUILD_VCS_NUMBER"] | |
end | |
[commit, commit_date, branch] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment