Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to undo hg init?

I typed hg init in a directory, but then changed my mind: I'd rather not have this under version control. So how do I undo hg init?

I suppose there is another solution than deleting .hg directories, but I couldn't find the command. Or is it impossible for mercurial to remove itself from a project?

like image 607
clstaudt Avatar asked Jan 18 '13 15:01

clstaudt


People also ask

How do I revert changes in Mercurial?

Reverting Local Changes If you use the TortoiseHg client to work with Mercurial from TestComplete, you can cancel all local changes not committed to the repository yet: Select File > Source Control > Revert from the TestComplete main menu.

How do you revert the last push in Heartgold?

hg rollback reverts the last transaction, so you'd be left with unfinished merge, which you have to use hg update -C to get out. If you don't want *b (you have it in another clone), then enable the built-in MQ extension and run hg strip -r <*b> . It will get rid of *b and *merge.

How can I delete last commit in Mercurial?

If you are still in the draft phase (not pushed elsewhere yet), use the built-in extension hg strip <rev> command. Otherwise, you should do a hg backout , which will reverse the changeset. In case you still need the commit you made, I suggest you export it to import it again in the correct branch, before stripping.


2 Answers

Why don't using

rm -rv .hg/ on Linux/Unix systems or under MacOS

or

rmdir /S .hg on WIndows systems (with the good ol' cmdline, the first example works under the PowerShell too).

It's simple and effective and does what you want: Removing Mercurial from the project.

like image 124
akluth Avatar answered Sep 28 '22 10:09

akluth


The only thing hg init does is adding the .hg directory and its contents.

So, undoing a hg init can indeed be done by simply deleting the .hg directory. It really cannot get any easier than this!

like image 25
Veger Avatar answered Sep 28 '22 08:09

Veger