title: Cannot git checkout master: invalid path '?'
body: <p>After an &quot;unsuccessful&quot; <code>git pull</code> on my local <code>master</code>, an error prevents to switch back to <code>master</code>:</p>
  <pre><code>C: repo_folder&gt; git checkout master
  error: invalid path '?'
  </code></pre>
  <p>The <code>?</code> must be because it is a <code>keybase</code> repo.</p>
  <p>From another branch where I checked out some files of the last commit:</p>
  <pre><code>C: repo_folder&gt; git diff origin/master --compact-summary
   &quot;\004&quot; (gone)                               | 1902  ---------------------------
   some irrelevant stuff                       | (num) -
  </code></pre>
  <p>The removed file <code>&quot;\004&quot;</code> (that was never present in my local) seems to come from some <code>Mac OS</code> (someone might have opened a <code>csv</code> and a temporary file was created when that user did the commit and pushed?).</p>
  <ul>
  <li>observe that the file that is marked as <code>(gone)</code> is to be removed by git</li>
  <li>the problem is that the filename has characters that are not compatible with the Windows file system and that the file never existed in my local Windows repo.</li>
  </ul>
  <p>If I clone from a Linux platform, I can checkout to <code>master</code> with no problems. However, in Windows, there's no way back to the <code>master</code> branch.</p>
  <p>Any ideas on how to solve this issue? (already tried some posts with no success)
  I can't really understand how it comes <code>git</code> doesn't even allow me to checkout to <code>master</code>. Should I file a bug report?</p>
  <p>Alternatively, perhaps I could create a new <code>master</code> branch and get rid of the current one.</p>
  <p><strong>EDIT</strong></p>
  <p>A clone from <code>Linux</code> helped to identify that the file <code>?</code> was actually there.
  This could be checked directly from Windows as well by using the command: <code>git ls-tree origin/master</code> (which was showing the original problematic name <code>&quot;\004&quot;</code>)</p>
  <p>The accepted answer includes the case where you want to save the content of the file, while in my case I only wanted to get rid of it. So in my case, I have just deleted the file from <code>Linux</code>, committed and pushed the change, and did a <code>git fetch origin master:master</code> to fetch my local <code>master</code> with being checked out in another branch (as I was not able to checkout to <code>master</code>). This finally did the trick and I could checkout to <code>master</code>.</p>
  <p>Hope this clarifies to someone with a similar problem.</p>