Where to put .hgignore?

I am wondering where to put the .hgignore file; basically repositories or should every programmer have it on their cloned copy?

Please clarify. Thanks.

+7
version-control mercurial
source share
5 answers

You must put the file in the root of your repository.

See:

He says :

These files can be ignored by specifying them in the .hgignore file in the root directory of the working directory. The .hgignore file must be created manually. Usually it is under version control, so the settings will be distributed to other repositories using push and pull .

Another advantage is that you can work on multiple projects. Each of them has its own set of file templates to ignore. For example, working on a Visual Studio project or a simple C ++ project or a Python project. This ensures that patterns to be ignored are relevant to the project.

As usual , you cannot replicate these patterns in every ignore file. In this case, the Mercurial configuration file may refer to a set of files for each user or global ignore.

Example for global ignore files

in ~ / .hgrc 1 :

[ui] ignore = ~/.hgignore 

in ~ / .hgignore:

 syntax: glob *.tex *.R 

1 On Windows: %USERPROFILE%\mercurial.ini , ~ refers to %USERPROFILE% on Windows.

+11
source share

I have never seen it anywhere except the main repository.

+1
source share

How do you ignore .hgignore without a .hgignore file in the repository to ignore it, P

Seriously .. this should probably be in the repository, since the files to be ignored are specific to the repositories; the user can, of course, indicate that their own are ignored additionally in the file specified in their .hgrc

+1
source share

you may have a global project root directory inside your ~/.hgrc or a specific project

0
source share

It belongs in the top folder of the repository. It is not intended for personal neglect, but for ignoring the project (i.e., for everyone). However, usually developers will add, for example, their favorite temp editor editor. files to this file - doesnโ€™t bother anyone.

If you want to ignore what others may not want to ignore, put it in your personal ignore in ~ / .hgrc.

0
source share

All Articles