Exclude a file from Mercurial

Find the .hgignore file and open in a texteditor

Add a line e.g. myfolder/mysubfolder/myfile.txt

or for a for the contents of a folder e.g. myfolder/mysubfolder/dontinclude/


If you already have a file in source control and you want to remove it, open a command prompt, navigate to the directory.

hg remove -Af myfile.txt

-A records a delete for missing files

-f forces this

So you could probably omit these switches.

Then commit and push as per usual




Leave a Reply

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.