How to apply commit to local changes?

Patrick Mézard pmezard at gmail.com
Wed Jan 20 04:04:34 CST 2010


Le 20/01/10 10:33, Aleksa Todorovic a écrit :
> Hi!
> 
> I accidentely commited some changes I didn't want to (let's call it
> commit A). So, I updated to previous revision, and continued
> development. Now, I want to apply commit A to my local modifications
> so I can pick changes which I want to commit, and others which I want
> to discard. I can, certainly do this "by hand", or through patch, but
> does Mercurial supports this operation?
> 
> Thanks in advance!

Not really, the problem being importing changes *on top of other local modifications*. Assuming you have no local changes you can do something like:

$ hg export A | hg import --no-commit -
$ hg record
# get rid of non-selected changes
$ hg revert -a

With your local modifications, I would commit them, do the sequence described above, then use an history rewriting extension like histedit to fold both commits. Or directly use mq extension.

--
Patrick Mézard


More information about the Mercurial mailing list