Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It should be pretty obvious from your question that you're actually just asking about the difference between <code>git merge</code> and <code>git rebase</code>. </p> <p>So let's suppose you're in the common case - you've done some work on your master branch, and you pull from origin's, which also has done some work. After the fetch, things look like this:</p> <pre><code>- o - o - o - H - A - B - C (master) \ P - Q - R (origin/master) </code></pre> <p>If you merge at this point (the default behavior of git pull), assuming there aren't any conflicts, you end up with this:</p> <pre><code>- o - o - o - H - A - B - C - X (master) \ / P - Q - R --- (origin/master) </code></pre> <p>If on the other hand you did the appropriate rebase, you'd end up with this:</p> <pre><code>- o - o - o - H - P - Q - R - A' - B' - C' (master) | (origin/master) </code></pre> <p><strong>The content of your work tree should end up the same in both cases; you've just created a different history leading up to it</strong>. The rebase rewrites your history, making it look as if you had committed on top of origin's new master branch (<code>R</code>), instead of where you originally committed (<code>H</code>). You should never use the rebase approach if someone else has already pulled from your master branch. </p> <p>Finally, note that you can actually set up <code>git pull</code> for a given branch to use rebase instead of merge by setting the config parameter <code>branch.&lt;name&gt;.rebase</code> to true. You can also do this for a single pull using <code>git pull --rebase</code>.</p>
    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