I'm new to Mercurial. I did hg status
and I saw the files that changed since the last commit have M
in front. I then tried hg update -C
. Is there any way I can get back the version of the files with M
before I did hg update -C
? Or am I pretty much screwed? :( since hg update -C
discards any changes since the last commit
The revert command allows discarding unwanted uncommitted changes.
If you want to revert just the latest commit use: hg strip --keep -r . Using strip will revert the state of your files to the specified commit but you will have them as pending changes, so you can apply them together with your file to a new commit.
Use the command hg update to switch to an existing branch. Use hg commit --close-branch to mark this branch head as closed.
Well, let's take a look:
PS C:\dev> hg init foo
PS C:\dev> cd .\foo
PS C:\dev\foo> echo ":)" > file.txt
PS C:\dev\foo> hg add
adding file.txt
PS C:\dev\foo> hg com -m ":D"
PS C:\dev\foo> echo "DDDD" >> .\file.txt
PS C:\dev\foo> hg sta
M file.txt
PS C:\dev\foo> hg up -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
PS C:\dev\foo> hg sta
PS C:\dev\foo> dir
Directory: C:\dev\foo
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 5/14/2013 4:06 PM .hg
-a--- 5/14/2013 4:06 PM 10 file.txt
PS C:\dev\foo> type .\file.txt
:)
It's gone. :( Sorry for the bad news!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With