how to remove a folder from tracking in mercurial

2k Views Asked by At

To ignore ./node_modules/ folder and .idea folder into .hgignore file so that I don't want to track them.

Currently I have the following rules on my .hgignore file.

*.orig
*./node_module/
*.idea/ 
*.rej
*~
*.o
tests/*.err

But abort error on hg status.

2

There are 2 best solutions below

1
Develop4Life On BEST ANSWER

finally i found tip . here is how to . Foradding node_modules/ and .idea/ folder you need to specify the following.N.B > is refers terminal.

touch .hgignore nano .hgignore

add the following

^node_modules/
^.idea/

Done !

0
planetmaker On

Well, hg help hgignore points to have a look at hg help patterns. I can't quite explain it better:

Mercurial accepts several notations for identifying one or more files at a
time.

By default, Mercurial treats filenames as shell-style extended glob
patterns.

Alternate pattern notations must be specified explicitly.

Note:
  Patterns specified in ".hgignore" are not rooted. Please see 'hg help
  hgignore' for details.

To use a plain path name without any pattern matching, start it with
"path:". These path names must completely match starting at the current
repository root.

To use an extended glob, start a name with "glob:". Globs are rooted at
the current directory; a glob such as "*.c" will only match files in the
current directory ending with ".c".

The supported glob syntax extensions are "**" to match any string across
path separators and "{a,b}" to mean "a or b".

(...)

Plain examples:

  path:foo/bar   a name bar in a directory named foo in the root
                 of the repository
  path:path:name a file or directory named "path:name"

There are alternate ways to specify paths using regex as well as also explained in the available command line help.

So, use something like

node_module/**
.idea/**

or

path:node_module
path:.idea

provided you quoted your entire .hgignore and thus use the default glob pattern matching.