title: In Mercurial what's the difference between hg graft and hg rebase
body: <p>I know <a href="https://www.mercurial-scm.org/wiki/RebaseExtension" rel="noreferrer">Rebase</a> is a (bundled) extension, while <a href="http://selenic.com/hg/help/graft" rel="noreferrer">Graft</a> is a core feature (that replaced the <a href="https://www.mercurial-scm.org/wiki/TransplantExtension" rel="noreferrer">Transplant</a> (bundled) extension).</p>
  
  <p><strong><code>graft</code></strong> is documented as:</p>
  
  <blockquote>
    <p>copy changes from other branches onto the current branch</p>
    
    <p>This command uses Mercurial's merge logic to copy individual changes from other branches without merging branches in the history graph. This is sometimes known as 'backporting' or 'cherry-picking'.</p>
  </blockquote>
  
  <p><strong><code>rebase</code></strong> is documented as:</p>
  
  <blockquote>
    <p>Rebase allows moving commits around in Mercurial's history (using a series of internal merges). This has many uses:</p>
    
    <ul>
    <li>moving changesets between branches</li>
    <li>"linearizing" history</li>
    <li>reordering changesets</li>
    <li>collapsing multiple changes into one changeset </li>
    </ul>
  </blockquote>
  
  <p>Both seem to use merging to move or copy changesets between branches.</p>
  
  <p>Graft copies. Rebase moves. But <code>rebase --keep</code> copies.</p>
  
  <p>So often it seems I can accomplish my goal of copying a changeset either way.
  Does it matter which one I use? When should I prefer one over the other?</p>
  
  <p>E.g. should graft only be used when copying to a different <em>named</em> branch? Or only when there's just a single changeset?</p>
  
  <hr>
  
  <p>Edit: Could it be that rebase is a potentially unsafe superset of graft, but can only be used with <code>draft</code> changesets during development for editing local history, while graft is a safe subset of rebase that can be used with <code>public</code> changesets during maintenance for backporting?</p>