title: How to overwrite remote branch with different local branch with git
body: <p>I have a remote branch that is the basis for a pullrequest.</p>
  
  <p>I mainly worked on a different branch, however that should now replace the old branch. </p>
  
  <p>I tried to do a <code>git push remote oldBranch -f</code> but that only pushes my latest local <code>oldBranch</code> to the git server instead of the current branch - no matter which branch i am currently on.</p>
  
  <p>How can I replace the remote branch with my local branch?</p>
  
  <p>EDIT:
  If anybody else is interested, this is how i got this to work:</p>
  
  <pre><code>git checkout oldBranch
  git branch -m 'oldBranchToBeReplaced'
  git checkout newBranch
  git branch -m oldBranch
  git push myrepo oldBranch -f
  </code></pre>