undoing a hg addremove mistake

Luke Mergner lmergner at gmail.com
Thu Jan 9 21:50:58 UTC 2014


Thanks to both Matt and Harvey. Using revert would lose several days of
work so I'm reluctant to do that. I'll try to revert just the lost files.
Either way thanks for the help, the great tool, and your hard work.

- Luke
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20140109/21119dad/attachment-0002.html>


More information about the Mercurial mailing list