I know Rebase is a (bundled) extension, while Graft is a core feature (that replaced the Transplant (bundled) extension).
graft
is documented as:
copy changes from other branches onto the current branch
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'.
rebase
is documented as:
Rebase allows moving commits around in Mercurial's history (using a series of internal merges). This has many uses:
- moving changesets between branches
- "linearizing" history
- reordering changesets
- collapsing multiple changes into one changeset
Both seem to use merging to move or copy changesets between branches.
Graft copies. Rebase moves. But rebase --keep
copies.
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?
E.g. should graft only be used when copying to a different named branch? Or only when there's just a single changeset?
Edit: Could it be that rebase is a potentially unsafe superset of graft, but can only be used with draft
changesets during development for editing local history, while graft is a safe subset of rebase that can be used with public
changesets during maintenance for backporting?