title: How to switch to a different remote branch in git
body: <p>I have 3 local and 3 remote branches and want to be on the same branch on both.</p>
  
  <p><strong>on local:</strong></p>
  
  <pre><code>git branch
    A
  * B
    master
  
  git branch -r
    origin/A
    origin/B
    origin/master
  </code></pre>
  
  <p><strong>on remote:</strong></p>
  
  <pre><code>git branch
    A
    B
  * master
  </code></pre>
  
  <p>I am able to commit, push and pull B but my update hook deploys master instead of B, I suppose because the remote branch is still set to master. I created branch B using:</p>
  
  <pre><code>git branch B
  git checkout B
  git push origin B
  </code></pre>