title: Why does `git reset --hard HEAD~X` leave untracked files behind?
body: <p>From <a href="https://stackoverflow.com/questions/4327708/git-reset-hard-head-leaves-untracked-files-behind">git reset --hard HEAD leaves untracked files behind</a>:</p>
  
  <blockquote>
    <p>When I run <code>git reset --hard HEAD</code>, it's supposed to reset to a
    pristine version of what you pulled, as I understand it.
    Unfortunately, it leaves files lying around, as a <code>git status</code> shows a
    big list of untracked files.</p>
    
    <p>How do you tell git "Just bring it back to EXACTLY what was in the last pull, nothing more, nothing less"?</p>
  </blockquote>
  
  <p>To get rid of these files I have to run <code>git clean -df</code>.</p>
  
  <p>Can somebody please explain <strong>why</strong> it works this way and which files will become untracked?</p>