<p>A git rebase is like a git merge done through rose-coloured glasses.</p>

<p>
You can see it for yourself by doing this little experiment. Assuming the <code>alice</code> directory is a valid git repository&#58;
</p>

<pre><code>$ cd alice
$ echo "foo" &gt;&gt; rebase.episode
$ git add rebase.episode ; git commit -m 'begin rebase episode'
$ git checkout -b monsters

$ git branch
* monsters
master
$ echo "ghoul" &gt;&gt; ghoul.txt
$ git add ghoul.txt ; git commit -m 'ghoul'
$ git checkout master
$ echo "rogue" &gt;&gt; rogue.txt
$ git add rogue.txt ; git commit -m 'rogue'

$ git checkout monsters
$ echo "dragon" &gt;&gt; dragon.txt
$ git add dragon.txt ; git commit -m 'dragon'

$ git checkout master
$ echo "paladin" &gt;&gt; paladin.txt
$ git add paladin.txt ; git commit -m 'paladin'
</code></pre>

<p>
You have now emulated a bunch of activity on two separate branches of a git repository.
Create a copy of the repo so that you can perform two separate git actions.
</p>

<pre><code>$ cd ..
$ cp -r alice alice-merge
$ cp -r alice alice-base
</code></pre>

<p>
Do an honest merge&#58;
</p>

<pre><code>$ cd alice-merge
$ git checkout master
$ git merge monsters
</code></pre>

<p>
The log shows you an accurate representation what got merged, and how all those changes came to be&#58;
</p>

<pre><code>$ git log --oneline
123456 Merged monsters into master
789101 paladin
112131 dragon
415161 rogue
718191 ghoul
7ef217 begin rebase episode
</code></pre>

<p>
Now perform a rebase.
</p>

<pre><code>$ cd ../alice-base
$ git checkout master
$ git rebase monsters
</code></pre>

<p>
The log displays a different story than what really happened.
</p>

<pre><code>123456 Merged monsters into master
8e9122 paladin
21d163 rogue
912a3f dragon
51c098 ghoul
7ef217 begin rebase episode
</code></pre>

<p>
Better? Worse? YOU DECIDE&#33;
</p>

