I often notice a few unwanted changes when I review my working copy (with hg status
and hg diff
) right before a commit. For example, I might have temporarily added or remove some code just for the duration of a debugging session.
I know I can use hg revert
to remove unwanted changes, but this removes all the changes in the entire file. Is there a way to revert just a part of a file?
I've been doing this with the interactive ncurses style ui hg revert -i
that lets you walk around and select the parts you want to destroy, either file, diff chunk or line by line, as you please, depending on how deep you unfold your changes.
I am not sure if this is a standard hg
feature or not, you can verify easily enough if yours has it:
> hg revert --help --verbose | grep -- -interactive
-i --interactive interactively select the changes (EXPERIMENTAL)
Just remember that the changes you mark (X
) will be what gets nuked, not what you retain.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With