Search code examples
mercurial

How to retroactively remove `hg cp source targe` linkage?


I've got a change that has some files that I initially created using hg cp source target. However, looking at the diffs for these, the files ended up being so different that keeping the linkage with the source files makes for really hard-to-read diffs.

How can I break that link in my commit before I push this change upstream?


Solution

  • Discovered a method by experimentation. I don't know if this is the most efficient way, but it seems to work:

    $ hg uncommit path/to/file
    $ hg revert path/to/file
    $ hg add path/to/file
    $ hg amend