# Here is the code:<p># Challenge and learning Git rebase and resolve conflics<p># you need to order into the master branch either git history and content of other two branches without adicional commits in history line.<p># you can see result of this graph with 'gitx'<p>mkdir challenge_rebase; cd challenge_rebase<p>git init; touch content.txt; git add .;<p>echo 'A' >> content.txt; git commit -a -m 'A';<p>echo 'B' >> content.txt; git commit -a -m 'B';<p>git checkout -b foo master;<p>echo 'C' >> content.txt; git commit -a -m 'C';<p>echo 'D' >> content.txt; git commit -a -m 'D';<p>echo 'E' >> content.txt; git commit -a -m 'E';<p>echo 'F' >> content.txt; git commit -a -m 'F';<p>git checkout -b bar master;<p>echo 'G' >> content.txt; git commit -a -m 'G';<p>echo 'H' >> content.txt; git commit -a -m 'H';<p>echo 'I' >> content.txt; git commit -a -m 'I';<p>echo 'J' >> content.txt; git commit -a -m 'J';<p>git checkout master;<p>echo 'L' >> content.txt; git commit -a -m 'L';<p>echo 'M' >> content.txt; git commit -a -m 'M';<p>echo 'N' >> content.txt; git commit -a -m 'N';<p># What is correct response to make order into the master branch either git history and content of other two branches without adicional commits in history line?
<p><pre><code> # result ...
git rebase foo bar
# ... resolve conflicts
git add content.txt
git rebase --continue
# HERE is the trick... we have several ways to make this.
git rebase --onto bar master~3 master
# .. resolve conflicts
git add .
git rebase --continue</code></pre>