title: git - have log commits but missing .sln file so cannot open project - how to restore
body: <p>Is there any way to restore my project files using git.</p>
  
  <p>Here is the scenario....
  I worked on a branch for few days.  <strong>This branch was never pushed to remote repo</strong>, so it is entirely local.</p>
  
  <p>I ended up loosing my .sln solution file so I cannot open the project any more but in the project directory I do have the .git directory still.</p>
  
  <p>If I issue git log, I can see it lists commit far back so the logs seem to exists.</p>
  
  <p>is there a way to somehow find files in these logs or restore my project based on the commits in log?  Or is there some other way?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks to @RomainValeri, <code>git checkout &lt;commit-hash&gt;</code> works but it sets HEAD in detached state.  While that might not be big deal, later I found that <code>git reset --hard HEAD~1</code> works better since I dont need to keep changes in last commit, so using <code>--hard</code> discards them.  If you need to keep these changes, using <code>--soft</code> instead will reset HEAD to your commit before last commit and add changes in last commit to staging area.</p>
  
  <pre><code>git reset --hard HEAD~1
  git reset --hard HEAD~2
  git reset --hard HEAD~3
  ...
  </code></pre>
  
  <p>Above commands reset HEAD pointer 1, 2, 3, ... commits before last commit and discard any changes after.  Use --soft instead of --hard if you dont want to discard these changes in which case these changes will be staged for you.</p>