How can I retrieve the current Git commit version from within a Ruby on Rails app?
Want to display the Git version (or maybe the last 6 letters or so) to serve as an App version.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can invoke the
gitcommand from within your script:Depending on your environment you may want to use the full path to the git binary, and possibly specify the GIT_DIR via an environment variable or
--git-dir.