How do you remove a Mercurial repository

21,252

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

Share:
21,252

Related videos on Youtube

Jon Cox
Author by

Jon Cox

Check out my UK train times iPhone app: Railboard https://itunes.apple.com/us/app/railboard/id1278747705?ls=1&mt=8

Updated on August 02, 2020

Comments

  • Jon Cox
    Jon Cox almost 4 years

    I accidently put a Mercurial repository in the wrong place. How do I remove it? This is in Linux.

  • Jon Cox
    Jon Cox over 13 years
    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 :)
  • Brandon Rhodes
    Brandon Rhodes over 13 years
    Alas, 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.
  • Martin Geisler
    Martin Geisler over 13 years
    Jonathan: 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
    Martin Geisler over 13 years
    Brandon: 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
    Martin Geisler over 12 years
    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 :-)
  • Bobby Adams
    Bobby Adams about 12 years
    I'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.