7

Is there a command line way to ignore an entire subfolder in my repository?

flag
See also kiln.stackexchange.com/questions/707/… – CADbloke Apr 28 2010 at 22:48

2 Answers

6

Could you specify what you mean by command line way. If you just need to ignore a subfolder in your repository you should add an entry to your .hgignore file, for example if I need to ignore folders bin\ and obj\ I add following lines to my .hgignore file:

syntax: glob
obj/*
bin/*

Detailed information you can find here: http://www.selenic.com/mercurial/hgignore.5.html

link|flag
re: specify - just wondering if there was an 'hg ignore /myfolder/' command. Creating an .hgignore file is easy enough I suppose, just didn't want to go to the trouble, if I was overlooking a built in hg command. Thanks! :-) – unknown (google) Mar 23 2010 at 20:45
I blindly followed kiln's getting started instructions and committed + pushed all the project's files/folders...including the ones I want to ignore. Now that I have added the .hgignore file I can't figure out how to get rid of the files I've already committed to the repo. – David Murdoch Mar 1 2011 at 13:34
Hi, David. You should explicitly exclude them from tracking. You can do it several ways: 1) if you want to permanently remove those files from your working directory and future Mercurial revisions, you should call hg remove <path_to_file> for each of those files; 2) if you only want to exclude those files from future revision but leave them in your working directory you should call hg forget <path_to_file> for each of them. – Anton Moiseev Mar 1 2011 at 20:29
4

Make a file called .hgignore in the root of your repository (if it doesn't already exist) and add the line:

syntax: glob
path/to/subfolder

That's it. Your subfolder is now ignored.

Note that Mercurial will not ignore files that are already checked in. You'll need to hg forget them first.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.