TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Challenger and learning Git rebase and resolve conflics

1 pointsby stvkochabout 10 years ago
# 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 &#x27;gitx&#x27;<p>mkdir challenge_rebase; cd challenge_rebase<p>git init; touch content.txt; git add .;<p>echo &#x27;A&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;A&#x27;;<p>echo &#x27;B&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;B&#x27;;<p>git checkout -b foo master;<p>echo &#x27;C&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;C&#x27;;<p>echo &#x27;D&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;D&#x27;;<p>echo &#x27;E&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;E&#x27;;<p>echo &#x27;F&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;F&#x27;;<p>git checkout -b bar master;<p>echo &#x27;G&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;G&#x27;;<p>echo &#x27;H&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;H&#x27;;<p>echo &#x27;I&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;I&#x27;;<p>echo &#x27;J&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;J&#x27;;<p>git checkout master;<p>echo &#x27;L&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;L&#x27;;<p>echo &#x27;M&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;M&#x27;;<p>echo &#x27;N&#x27; &gt;&gt; content.txt; git commit -a -m &#x27;N&#x27;;<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?

1 comment

stvkochabout 10 years ago
<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>