title: Git command to remove local branches that have a deleted upstream?
body: <p>There are lots of similar questions to this (e.g. <a href="https://stackoverflow.com/q/17983068/575530">this one</a> or <a href="https://stackoverflow.com/q/18081085/575530">this one</a>) but the accepted answers do not seem to answer my exact question.</p>
  
  <p>Branch1 is not merged into master. Machine A and Machine B both point to the same remote. Branch1 exists on that remote.</p>
  
  <p>On Machine A I delete Branch1 locally and push the deletion to the remote so that Branch1 and remotes/origin/Branch1 are deleted from Machine A and Branch1 is deleted from the remote.</p>
  
  <p>On Machine B I run </p>
  
  <ul>
  <li><code>git checkout Branch1</code> and then </li>
  <li><code>git checkout Branch2</code> and then </li>
  <li><code>git fetch --prune</code> </li>
  </ul>
  
  <p>That <code>git fetch --prune</code> removes remotes/origin/Branch1 from my local repository on Machine B. If I then go back to Branch1 by running <code>git checkout Branch1</code> I get the error message </p>
  
  <blockquote>
    <p>Switched to branch 'Branch1'<br>
    Your branch is based on 'origin/Branch1', but the upstream is gone.<br>
      (use "git branch --unset-upstream" to fixup)  </p>
  </blockquote>
  
  <p>Is there a git command to remove local branches that have a deleted upstream?</p>