title: How to get sha of current git commit from R
body: <p>Is there a way to get SHA of current GIT commit from R? I need to access it via a function call (not as a hard string). </p>
  
  <p>I have adapted GIT as version control system for analysis, and want to print the SHA on footnote of my intermediate reports (my working drafts, in pdf format, get a life of their own and it is not immediately obvious by looking at them at what moment they were generated; this creates a reproducibility issue).</p>
  
  <p>For reference: I am using R 3.4.1 via R Studio and creating reports via r markdown.</p>