how to restore file deleted with "update -C"
Robert Bauck Hamar
r.b.hamar at usit.uio.no
Mon Feb 14 11:49:23 UTC 2011
*plumo:
>I have accidentally deleted a file with mercurial and am wondering if it is
>possible to restore it.
>Here is my log:
>
>$ hg add main.py
>
>$ hg commit -m "message"
>
>$ hg push
>abort: push creates new remote heads!
>(did you forget to merge? use push -f to force)
>
>$ hg pull
>added 1 changesets with 1 changes to 1 files (+1 heads)
>(run 'hg heads' to see heads, 'hg merge' to merge)
>
>$ hg update
>abort: crosses branches (use 'hg merge' or 'hg update -C')
Note: This is not saying you should do this without knowing what the
commands do.
>$ hg merge
>abort: outstanding uncommitted changes
Outstandning uncommitted changes? Is there something you did that you
did not tell us between here and the "hg commit" above?
>$ hg update -C
>removing main.py
>0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>
>
>Now my main.py file is deleted. Not just removed from repository but deleted
>from file system! Very frustrating!
>Is there any way to restore it from mercurial's meta data?
Yes.
$ hg heads
Will list a number of heads, one of which is your last revision
containing the newly created main.py. "hg update" can take you back to
that revision.
--
Robert Bauck Hamar
USIT/SAPP/GT - Cerebrum
http://www.uio.no/sok?person=hamar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20110214/f0084ca2/attachment.asc>
More information about the Mercurial
mailing list