undo changes to a single file earlier in history with subsequent modifications

Simon King simon at simonking.org.uk
Thu Nov 22 13:02:22 UTC 2012


On Thu, Nov 22, 2012 at 11:35 AM, Wujek Srujek <wujek.srujek at gmail.com> wrote:
> Hi. I needed to revert a change done to a single file only, and the
> changeset was not the latest one, and after that change, the file was
> further changed. What I did was sth like:
> hg diff -r 194:193 file/to/change > ../reverse.diff
> hg patch --no-commit ../reverse.diff
>
> The problem is that this is based on patches, and there could be some
> rejects if the reverse diff was no longer consistent with the other changes
> that were done later, right? (In my case, it applied cleanly, just asking.)
>
> Is there a better way to achieve what I wanted?
>
> wujek
>

I see "hg backout" takes a "--include" argument - would that do what you wanted?

ie (untested).

  hg backout --include file/to/change 194

Simon



More information about the Mercurial mailing list