title: How to run git checkout in ant?
body: <p>I have been reading this <a href="https://stackoverflow.com/questions/6990484/git-checkout-by-date/41558355#41558355">post</a> to git checkout by a specific date. I have been able to obtain the revision commit SHA code to the specific commit that I am targeting for the checkout, but when I am trying to actually run the git checkout command line I got the error:</p>
  
  <blockquote>
    <p>error: pathspec 'de957d59f5ebef20f34155456b8ab46f127dc345
    ' did not match any file(s) known to git.</p>
  </blockquote>
  
  <p>Not sure what that means. I am running this command from ant 1.94 on my windows 7 machine</p>
  
  <p>The ant command script looks as follow:</p>
  
  <pre><code> &lt;target name="git.revlist" description="Revision list of repo for a particular timeframe" &gt;
      &lt;exec executable="git" dir="${run.repo.dir}" failifexecutionfails="true" output="${output_commit_sha_file}" &gt;
          &lt;arg line="rev-list -n 1 --before=${snapshot_before_date} ${repo_branch}"/&gt;
      &lt;/exec&gt;
      &lt;loadfile property="output_commit_sha" srcfile="${output_commit_sha_file}"  /&gt;
      &lt;exec executable="git" dir="${run.repo.dir}" failifexecutionfails="true" &gt;
          &lt;arg line="checkout ${output_commit_sha}"/&gt;
      &lt;/exec&gt; 
   &lt;/target&gt;
  </code></pre>
  
  <p>Where the first execution actually retrieve the SHA (de957d59f5ebef20f34155456b8ab46f127dc345) code successfully, but when trying to use that for the second execution tasks command arguments, it throughs the above error.</p>
  
  <p>Any ideas/recommendations on what I am missing here. Like I mentioned, I do have several task command lines that look like this and are used to perform other tasks, like <code>git clone</code> and <code>git log</code>, but this one seems to be missing something crucial.</p>
  
  <p>Thanks in advance</p>