Mercurial: How to reapply a revision/changeset

Sometimes you have to collaborate with someone who doesn’t use version control. This will happen often if you’re sharing work over ftp.

If you make a change and then receive an old version of the file you changed with a new change of theirs, you can reapply your change with this command.

Let’s assume your change is in revision 78 and in file my/awesome/file.js

Go to the root of your repo and run:

hg diff -r77:78 my/awesome/file.js | patch p1

Happy merging!