title: Git error "fatal: XXX is not a commit and a branch YYY cannot be created from it
body: <p>I am trying the checkout a branch from a remote repository into a local branch, and receive the above error.</p>
  
  <p>For those who want to direct me to:
  <a href="https://stackoverflow.com/questions/49297153/why-is-it-not-a-commit-and-a-branch-cannot-be-created-from-it">Why is it not a commit and a branch cannot be created from it?</a>, then I already tried fetching, and even
  <code>git fetch --all</code></p>
  
  <p>To be precise, I cannot checkout any branch on the Github repository, that is not the main branch that I'm tracking, let's call it <code>dev</code>.</p>
  
  <p>So, I can do the following:</p>
  
  <pre><code>git checkout origin/dev -b my_own_dev_env
  </code></pre>
  
  <p>But I cannot checkout any other branch, not even</p>
  
  <pre><code>git checkout origin/master -b master
  </code></pre>
  
  <p>And in this case I receive </p>
  
  <blockquote>
    <p>"fatal: 'origin/master' is not a commit and a branch 'master' cannot
    be created from it"</p>
  </blockquote>
  
  <p>Edit:
  When cloning to a new directory, I can perform all git operations as usual.
  So I would like to know what could go wrong in a local copy that prevents git commands from working properly?</p>