title: Is rebase and merge the same thing? Why are there 2 different procedures to do one thing?
body: <p>I am new to <code>git</code> and I am trying to understand the rebase. For me the merge process is easier to understand since my experience is in <code>Clearcase</code>.<br>
  So first of all I can not understand if rebase is exactly the same as merge or not. If it is why are there 2 procedures for the same thing?<br>
  Also I am reading this part from <a href="http://git-scm.com/book/en/Git-Branching-Rebasing#More-Interesting-Rebases" rel="nofollow noreferrer">git-branching</a>.<br>
  It has here:<br>
  <img src="https://i.stack.imgur.com/EVcGZ.png" alt="enter image description here">  </p>
  
  <p>Then it says:  </p>
  
  <blockquote>
    <p>$ git rebase --onto master server client<br>
    This basically says, “Check
    out the client branch, figure out the patches from the common<br>
    ancestor of the client and server branches, and then replay them onto
    master.” It’s a bit   complex; but the result, shown in Figure 3-32,
    is pretty cool.</p>
  </blockquote>
  
  <p>So I assume this command means take all the commits <em>after</em> common ancestor of server and client branches <strong>excluding</strong> the common ancestor. So we end up with the next picture.    </p>
  
  <p><img src="https://i.stack.imgur.com/xHEBG.png" alt="enter image description here">  </p>
  
  <p>Then it says:  </p>
  
  <blockquote>
    <p>Now you can fast-forward your master branch (see Figure 3-33):<br>
    $ git checkout master<br>
    $ git merge client</p>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/a3V4t.png" alt="enter image description here">  </p>
  
  <p>This example seems wrong to me.<br>
  In the second picture we "move" <code>C8</code> and <code>C9</code> as result of the <code>rebase</code>. Then we merge.<br>
  But <code>C8</code> comes out of <code>C3</code> and <code>C3</code> code is not present in the <code>master</code> branch.<br>
  After the <code>rebase</code> though the new <code>C8</code> i.e. <code>C8'</code> is in front of <code>master</code> and actually has the <code>master</code> as previous in chain.<br>
  But how can this work? If <code>C8</code> is dependent on <code>C3</code> the <code>rebase</code> fails since <code>C3</code> is not part of the <code>branch</code>.<br>
  E.g. if in <code>C3</code> there is some function used by the client, it does not exist in <code>main</code> branch. So after the <code>rebase</code> the <code>C8'</code> will have a dependency in the function defined in <code>C3</code> that does not exist in <code>main</code>. So the code would not compile.<br>
  Could anyone help explaining the <code>rebase</code> workflow and if what I say about this part of the tutorial in <code>git-scm</code> (that it is wrong) is correct?</p>