undoing a hg addremove mistake

Matt Mackall mpm at selenic.com
Thu Jan 9 20:16:17 UTC 2014


On Thu, 2014-01-09 at 11:36 -0800, Luke Mergner wrote:
> Hi,
> 
> I am trying to recover some files from my working directory (a python
> project). Somehow using Vim, I created a file named ";".  Having forgotten
> about it, I later "hg addremove", which added the bad file. Being clever, I
> decided to remove it with hg by saying...
> 
> $ hg remove directory/;

';' is the shell's command separator. Would have worked with quoting or
a well-placed backslash.

> ...which removed a about a dozen files in several child directories. I
> haven't committed yet. However, saying "hg add *" doesn't seem to do
> anything since the files appear to be completely gone. Is this the case
> even though I didn't say --force?

Probably not, as Mercurial won't delete files it hasn't committed
without some extra coaxing. Try:

$ hg revert directory

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list