title: Why does git clean -xfd sometimes delete tracked files? How can we fix this?
body: <p>From time to time, <code>git clean -xfd</code> will not only remove untracked files and directories but also remove tracked files. After cleaning I can restore those tracked files with <code>git reset --hard head</code>. So my flow tends to be: </p>
  
  <pre><code>git clean -xfd
  
  git status               // check whether git deleted tracked files or not
  git reset --hard head    // if git deleted tracked files restore them
  </code></pre>
  
  <p>I suspect that this over-zealous deletion might be related to having renamed a file or directory in a previous commit, and that the clean then deleted that renamed item. This is only a guess.</p>
  
  <p>Is this a known issue? How can I fix it? </p>