I accidently put a Mercurial repository in the wrong place. How do I remove it? This is in Linux.
Asked
Active
Viewed 2.2k times
1 Answers
49
Recursively remove the .hg
directory? You can also just move it; they are portable, and the setup files inside of .hg
contain no absolute paths that would break if placed elsewhere on the system.
From the comments: rm -r .hg

Riley Lark
- 20,660
- 15
- 80
- 128

Brandon Rhodes
- 83,755
- 16
- 106
- 147
-
Fair enough, that's what I was going to do, I just assumed there was a 'proper' way to do it. Thanks for you help :) – Jon Cox Dec 21 '10 at 17:53
-
1Alas, no, there is no official Mercurial command, at least not one that I know about. They seem to prefer instead that people know a little about `.hg` instead of using a command line that hides that detail; for example, setting a default push location still requires (so far as I know?) that you manually edit `.hg/hgrc`. – Brandon Rhodes Dec 21 '10 at 17:55
-
11Jonathan: Removing it is quite proper. We try to keep simple things simple in Mercurial: `hg init` creates `.hg` for you, and `rm -r .hg` will undo that. – Martin Geisler Dec 30 '10 at 10:23
-
2Brandon: yes, you edit `.hg/hgrc` manually. There has been some talk about making a command that would open up the right file in your editor, but full-blown editing via the command line has been left out since using an editor ought to be easier for a programmer. – Martin Geisler Dec 30 '10 at 10:27
-
About editing configuration files: When people say that they prefer a command over editing the config file manually, Matt (the Mercurial project leader) often replies that this is like a doctor that cannot stand the sight of blood. Editing a configuration file in an editor of your choice should *not* be considered hard by programmers :-) – Martin Geisler Jan 18 '12 at 15:30
-
6I'm using TortoiseHg on Windows 7 64-bit and it wouldn't allow me to delete the .hg directory the first time I tried. I looked around a bit, found this, and then tried deleting the contents of the directory first, then refreshing the icons, then deleting the directory and that seemed to work. – BlueMonkMN Apr 08 '12 at 21:55