What is preferred way to undo add?

Christian Boos cboos at neuf.fr
Mon Jun 5 09:19:36 CDT 2006


Kyle Butt wrote:
> On Mon, Jun 05, 2006 at 09:23:54AM -0400, Neal Becker wrote:
>   
>> If I did add but not yet commit, what is the 'best' way to undo the add?
>>
>>     
> I believe you want hg forget
> then mercurial will undo the add, and not the last transaction (which is
> not what you want.
>   

No, "hg forget" has been deprecated in favor of "hg revert".

And "hg revert" doesn't undo the last transaction, that's "hg rollback".
"hg revert" restores the content of the working dir to match the
content of the repository at some given revision (as given by -r
or, by default, the "parent revision" of the working directory,
which is the one set by the last "hg update" operation)

(leaving the discussion about the possible second parent revision
of the working directory aside ;) )

-- Christian


More information about the Mercurial mailing list