title: How do I fix a Git detached head?
body: <p>I was doing some work in my repository and noticed a file had local changes. I didn't want them anymore so I deleted the file, thinking I can just checkout a fresh copy. I wanted to do the Git equivalent of</p>
  
  <pre><code>svn up .
  </code></pre>
  
  <p>Using <code>git pull</code> didn't seem to work. Some random searching led me to a site where someone recommended doing</p>
  
  <pre><code>git checkout HEAD^ src/
  </code></pre>
  
  <p>(<code>src</code> is the directory containing the deleted file).</p>
  
  <p><strong>Now I find out I have a detached head. I have no idea what that is. How can I undo?</strong></p>