Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That seems consistent with what a rebase does.</p> <ul> <li><p><a href="http://git-scm.com/docs/git-svn" rel="noreferrer"><code>git svn rebase</code></a> will fetches revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it.</p></li> <li><p><a href="http://git-scm.com/docs/git-rebase" rel="noreferrer"><code>git rebase</code></a> does mention:<br> Note that a rebase merge works by replaying each commit from the working branch on top of the <code>&lt;upstream&gt;</code> branch.<br> Because of this, when a merge conflict happens:</p> <ul> <li><strong>the side reported as ours is the so-far rebased series, starting with <code>&lt;upstream&gt;</code></strong>,</li> <li><strong>and theirs is the working branch</strong>.<br> In other words, <strong>the sides are swapped</strong>.</li> </ul></li> </ul> <blockquote> <p>git rebase replays each commit from the working branch on top of the <code>&lt;upstream&gt;</code> branch. </p> </blockquote> <p>If you reconcile both definitions:</p> <ul> <li>the commits coming from SVN are the ones on top of which local Git commits are replayed. They are part of the "so-far rebased series", and are referenced as "our" (in your case, the <code>test.txt</code> file with <code>bar</code> content)</li> <li>the working branch (containing Git commits unknown to SVN, in your case, the <code>test.txt</code> file with <code>baz</code> content) is "their", and each of those local Git commits are being replayed.</li> </ul> <p>In other words, SVN or not:</p> <ul> <li>the "<code>&lt;upstream&gt;</code>" branch (on top of which anything is replayed, and which is part of the so far rebased commits") is "<strong>ours</strong>".</li> <li>what is being replayed (the working branch) is "<strong>theirs</strong>".</li> </ul> <hr> <p>Good <a href="https://stackoverflow.com/questions/25576415/what-is-the-precise-meaning-of-ours-and-theirs-in-git-especially-in-referen/25576672#comment39946814_25576672">mnemonic tip</a> by <a href="https://stackoverflow.com/users/811519/commatoast">CommaToast</a>:</p> <blockquote> <p><strong>whatever HEAD's pointing to is "ours"</strong></p> </blockquote> <p>(and the first thing a <code>git rebase upstream</code> does it to checkout the <code>upstream</code> branch on top of which you want to rebase: HEAD refers to <code>upstream</code> -- <code>ours</code> now.)</p> <hr> <p>The confusion is likely coming from the role of the working branch in a classic <a href="http://www.kernel.org/pub/software/scm/git/docs/git-merge.html" rel="noreferrer"><code>git merge</code></a>.<br> When you are merging:</p> <ul> <li>the "working branch" is the one containing what is "so far merged", and is considered as "our", </li> <li>while the other commit represent what is being -- not replayed but -- merge on top of the working branch, and considered as "their".</li> </ul> <p>As the <code>git rebase</code> man page mentions, a merge during a rebase means the side are swapped.</p> <hr> <p>Another way to say the same thing is to consider that:</p> <ul> <li><strong>what we have</strong> on the checked out branch is '<strong>ours</strong>',</li> <li><strong>what we had</strong> (and is being merged or replayed) is '<strong>theirs</strong>'.</li> </ul> <hr> <p><strong>On a merge</strong>:</p> <pre><code>x--x--x--x--x(*) &lt;- current branch B ('*'=HEAD) \ \ \--y--y--y &lt;- other branch to merge </code></pre> <p>, we don't change the current branch 'B', so what we have is still what we were working on (and we merge from another branch)</p> <pre><code>x--x--x--x--x---------o(*) MERGE, still on branch B \ ^ / \ ours / \ / --y--y--y--/ ^ their </code></pre> <hr> <p>But <strong>on a rebase</strong>, we switch side because the first thing a rebase does is to checkout the upstream branch! (to replay the current commits on top of it)</p> <pre><code>x--x--x--x--x(*) &lt;- current branch B \ \ \--y--y--y &lt;- upstream branch </code></pre> <p>A <strong><code>git rebase upstream</code></strong> will first change <code>HEAD</code> of B to the upstream branch <code>HEAD</code> (hence the switch of 'ours' and 'theirs' compared to the previous "current" working branch.)</p> <pre><code>x--x--x--x--x &lt;- former "current" branch, new "theirs" \ \ \--y--y--y(*) &lt;- upstream branch with B reset on it, new "ours", to replay x's on it </code></pre> <p>, and then the rebase will replay 'their' commits on the new 'our' B branch:</p> <pre><code>x--x..x..x..x &lt;- old "theirs" commits, now "ghosts", available through reflogs \ \ \--y--y--y--x'--x'--x'(*) &lt;- branch B with HEAD updated ("ours") ^ | upstream branch </code></pre> <hr> <p>The only extra step with <strong><code>git svn rebase</code></strong> is that a svn "fetch" is performed first on the Git remote branch representing SVN commits.<br> You have initially:</p> <pre><code>x--x--x--x--x(*) &lt;- current branch B, "ours" for now. \ \ \--y--y--y &lt;- SVN tracking branch, "theirs for now" </code></pre> <p>, you first update the SVN tracking branch with new commits coming from SVN</p> <pre><code>x--x--x--x--x(*) &lt;- current branch B, still "ours", not for long \ \ \--y--y--y--y'--y' &lt;- SVN tracking branch updated </code></pre> <p>, then you switch the current branch to the SVN side (which becomes "ours")</p> <pre><code>x--x--x--x--x &lt;- for "B", now "their" during the rebase \ \ \--y--y--y--y'--y'(*) &lt;- SVN tracking branch updated, and branch B: now "ours" (this is "what we now have") </code></pre> <p>, before replaying the commits you were working on (but which are now "theirs" during that rebase)</p> <pre><code>x--x..x..x..x &lt;- old "theirs" commits, now "ghosts", available through reflogs \ \ \--y--y--y--y'--y'--x'--x'--x'(*) &lt;- branch B with HEAD updated ("ours") ^ | upstream SVN tracking branch </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload