Is there a way to have transplant a single changeset without commiting? I'd like to be able to review the changes prior to doing a commit.
Asked
Active
Viewed 2,640 times
2 Answers
8
hg transplant
always results in a new changeset in your repository.
However, you could:
- Use
hg export
andhg import --no-commit
instead OR - Use
hg transplant
and thenhg strip
if you don't like the changeset

Botje
- 26,269
- 3
- 31
- 41

Tim Henigan
- 60,452
- 11
- 85
- 78
-
`hg export -o - -r
| hg import --no-commit -` – user377178 Mar 15 '19 at 11:14
3
Found this question when searching for "graft without commit".
I've found I can do what I want by updating to the changeset where I want the changes to be on top of, then using the "hg revert" command.
So if I have changeset "R1" then I commit a "R2" I can put the R2 changes back into the working directory by doing:
- hg update -r R1 <-- (this puts your working directory in exact state you want to start from)
- hg revert --all -r R2 <-- (this applies the changes in R2 to the working directory, without committing those changes)
You can then strip the R2 changeset if you want or do whatever you want.

Shorn
- 19,077
- 15
- 90
- 168
-
Wouldn't `hg revert --all -r R2` do much more than cherrypick `R2` into the current changeset without committing? IIUC, it would completely overwrite any changes made to the files in `R1`, replacing the entire files with whatever contents they have in `R2`? – max Sep 02 '18 at 21:21