title: git-rebase: Converge two diverging branches/repositories
body: <p>Assume I have the following situation:</p>
  
  <p>There is a repository main of User Foo. User Bar forks this repository, so both repositories are in sync. Now user Bar implements a feature and creates a local branch called "barbranch". By the time user Bar is finished with implementing a feature, Foo committed and pushed something to the main repository. So basically the situation looks like this:</p>
  
  <pre><code>A---B---C---D    main repository
           \
            E      forked repository (where C=E)
             \
              F    barbranch on forked repository
  </code></pre>
  
  <p>Now how can stuff be brought back to normal in user Foo's repo?</p>
  
  <p>Naively I would say:</p>
  
  <pre><code># switch to the local master and merge barbranch into it
  git checkout master
  git pull
  git pull upstream
  git push
  git merge barbranch
  # merge conflicts occur
  vi somefile
  git commit -a
  git rebase origin master
  # this conflict occurs again
  vi somefile
  git commit -a
  git status # says I'm on (no branch) ?!
  git push
  g    it checkout master
  # conflict occurs again!
  vi somefile
  git commit -a
  git push
  # send merge request to user Foo
  </code></pre>
  
  <p>Finally this gives me three ugly commits instead of one.</p>
  
  <p>Checking out the git-rebase documentation I found <code>git rebase --onto ...</code>. Though I cannot figure out what the exact command would be and would that whole process would look like in the end.</p>