title: Git: get a hash of the current state of the working tree?
body: <p>I would like to ensure that my executable is built with the most up to date version of the code.</p>
  
  <p>For example, I can take the current git commit at the time of compile and bake it into the executable; then when the executable is run, it compares this with the current git commit and if they don't match it complains that the code has been modified and that it is out of date.</p>
  
  <p>However, sometimes I recompile without making a commit, after making small changes to a the code. Then this method doesn't work, as it only accounts for committed changes.</p>
  
  <p>Is there any convenient way to programatically get a hash of the current commit PLUS the state of the working directory, using git or otherwise?</p>
  
  <p>Also, is there a name for this practice?</p>