hg – Ignore directory at root only
You can include syntax: regexp at the beginning of .hgignore and then use perl regex syntax to root a directory by using ^. So just ^static should do the work.
You can include syntax: regexp at the beginning of .hgignore and then use perl regex syntax to root a directory by using ^. So just ^static should do the work.
Try it without the slash after the caret in the regexp version. ^test/ Here’s a test: ~$ mkdir hg-folder-ignore ~$ cd hg-folder-ignore ~/hg-folder-ignore$ echo ‘^test/’ > .hgignore ~/hg-folder-ignore$ hg init ~/hg-folder-ignore$ mkdir test ~/hg-folder-ignore$ touch test/ignoreme ~/hg-folder-ignore$ mkdir -p srcProject/test/TestManager ~/hg-folder-ignore$ touch srcProject/test/TestManager/dont-ignore ~/hg-folder-ignore$ hg stat ? .hgignore ? srcProject/test/TestManager/dont-ignore Notice that ignoreme isn’t showing … Read more
By pulling from this previous answer about Visual Studio 2010, from this response in this question, and this wonderful citation I compiled this listing: ############################################################ ## Visual Studio 2012 ############################################################ syntax: glob ## User-specific files *.suo *.user *.sln.docstates ## Build results [Dd]ebug/ [Rr]elease/ x64/ build/ [Bb]in/ [Oo]bj/ ## MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* *_i.c *_p.c … Read more
If the files you want to omit from the “hg commit” command are already “tracked”, you should use the -X option. The pattern passed to -X is pretty flexible, making it possible to run for example: % hg stat A etc/foo.conf M src/bar.c M lib/libbar/loader.c % hg commit -X ‘**.conf’ to avoid committing any file … Read more
This is what I was looking for. Add the following to the repo’s .hg/hgrc: [ui] ignore = /path/to/repo/.hg/hgignore and create a new file .hg/hgignore beside it. This new file will be untracked, but work the same as the versioned .hgignore file for this specific working copy. (The /path/to/repo bit is unfortunate but necessary to make … Read more
If you’re just using glob syntax in your hgignore, then all you’d need to do is rename it, and it should just work. If you’re using regex syntax then it’s going to be a different story…
The answer from Michael is a fine one, but another option is to just exclude: foo/bar/** and then manually add the .jar files. You can always add files that are excluded by an ignore rule and it overrides the ignore. You just have to remember to add any jars you create in the future.
Using a file template is definitely the best solution. For example, if you have a database.ini file, commit a database.ini.template file and ignore database.ini in .hgignore
You can add a path to a global or per-user ignore file in the [ui] section of your global/user hgrc or Mercurial.ini: [ui] ignore = ~/.hgignore On Windows: [ui] ignore = %USERPROFILE%\.hgignore
.hgignore does not need to be created before init It the config file will be used by others, you’d better commit the .hgignore so others dont have to create it, but this is not needed for mercurial to ignore your local files (see example) Yes .hgignore has to be in the root directory Simple example. … Read more