title: Rebasing remote branches in Git
body: <p>I am using an intermediate Git repository to mirror a remote SVN repository, from which people can clone and work on. The intermediate repository has it's master branch rebased nightly from the upstream SVN, and we are working on feature branches. For example:</p>
  
  <pre><code>remote:
    master
  
  local:
    master
    feature
  </code></pre>
  
  <p>I can successfully push my feature branch back to the remote, and end up with what I expect:</p>
  
  <pre><code>remote:
    master
    feature
  
  local:
    master
    feature
  </code></pre>
  
  <p>I then re-setup the branch to track the remote:</p>
  
  <pre><code>remote:
    master
    feature
  
  local:
    master
    feature -&gt; origin/feature
  </code></pre>
  
  <p>And all is well. What I would like to do from here is to rebase the feature branch to the master branch on the remote, but I would like to do this from my local machine. I'd like to be able to do:</p>
  
  <pre><code>git checkout master
  git pull
  git checkout feature
  git rebase master
  git push origin feature
  </code></pre>
  
  <p>To keep the remote feature branch up-to-date with the remote master. However, this method causes Git to complain:</p>
  
  <pre><code>To &lt;remote&gt;
   ! [rejected]        feature -&gt; feature (non-fast-forward)
  error: failed to push some refs to '&lt;remote&gt;'
  To prevent you from losing history, non-fast-forward updates were rejected
  Merge the remote changes (e.g. 'git pull') before pushing again.  See the
  'Note about fast-forwards' section of 'git push --help' for details.
  </code></pre>
  
  <p><code>git pull</code> does the trick but causes a merge commit that I'd like to avoid. I'm concerned that the message states <code>feature -&gt; feature</code> rather than <code>feature -&gt; origin/feature</code> but this may just be a presentation thing. </p>
  
  <p>Am I missing something, or going about this in completely the wrong way? It's not critical to avoid doing the rebase on the remote server, but it makes fixing any merge conflicts from the rebase much harder.</p>