<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rebase on Cheat Sheet</title><link>/tags/rebase/</link><description>Recent content in Rebase on Cheat Sheet</description><generator>Hugo</generator><language>en</language><atom:link href="/tags/rebase/index.xml" rel="self" type="application/rss+xml"/><item><title>rebase</title><link>/dotfiles/git/rebase/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/dotfiles/git/rebase/</guid><description>&lt;h1 id="rebase"&gt;rebase&lt;a class="anchor" href="#rebase"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="onto"&gt;&amp;ndash;onto&lt;a class="anchor" href="#onto"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;--onto&lt;/code&gt; option allows you to take a range of commits from one branch and &amp;ldquo;transplant&amp;rdquo; them onto another, even if they do not share a direct parent-child relationship.&lt;/p&gt;
&lt;h3 id="usage"&gt;Usage&lt;a class="anchor" href="#usage"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f7f7f7;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ git rebase --onto &amp;lt;newbase&amp;gt; &amp;lt;upstream&amp;gt; &amp;lt;branch&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;newbase&amp;gt;&lt;/code&gt;: The branch or commit where you want the changes to land.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;upstream&amp;gt;&lt;/code&gt;: The reference point to exclude history from. Git replays the range &lt;code&gt;&amp;lt;upstream&amp;gt;..&amp;lt;branch&amp;gt;&lt;/code&gt;, meaning everything reachable from &lt;code&gt;&amp;lt;branch&amp;gt;&lt;/code&gt; but &lt;strong&gt;not&lt;/strong&gt; reachable from &lt;code&gt;&amp;lt;upstream&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;branch&amp;gt;&lt;/code&gt;: The branch containing the commits you want to move (optional if currently checked out).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="how-it-differs-from-standard-rebase"&gt;How it differs from standard rebase&lt;a class="anchor" href="#how-it-differs-from-standard-rebase"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A standard &lt;code&gt;git rebase &amp;lt;upstream&amp;gt;&lt;/code&gt; automatically identifies the &lt;strong&gt;common ancestor&lt;/strong&gt; between &lt;code&gt;&amp;lt;upstream&amp;gt;&lt;/code&gt; and the current branch. It then replays all commits that come after that ancestor onto the tip of &lt;code&gt;&amp;lt;upstream&amp;gt;&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>