Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put .hgignore?

I'm wondering where to put .hgignore file; in the main repository or each programmer should have it on his cloned copy?

Please clarify. Thanks.

like image 663
emurad Avatar asked Dec 05 '10 21:12

emurad


3 Answers

You should put the file at the root of your repository.

See :

  • https://www.selenic.com/mercurial/hgignore.5.html
  • https://www.mercurial-scm.org/wiki/.hgignore

It says:

These files can be ignored by listing them in a .hgignore file in the root of the working directory. The .hgignore file must be created manually. It is typically put under version control, so that the settings will propagate to other repositories with push and pull.

Also another advantage is that, you might be working on multiple projects. Each having it's own set of pattern of files to ignore. For example, working on a Visual Studio project or a simple C++ project or a Python project. This ensures that patterns to ignore are relevant to the project.

How ever, you may not want to replicate these patterns in every ignore files. In such a case Mercurial configuration file can reference a set of per-user or global ignore files.

Example for global ignore files

in ~/.hgrc1:

[ui]
ignore = ~/.hgignore

in ~/.hgignore:

syntax: glob
*.tex
*.R

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

like image 187
pyfunc Avatar answered Oct 17 '22 17:10

pyfunc


I've never seen it anywhere but the main repository.

like image 1
dahlbyk Avatar answered Oct 17 '22 18:10

dahlbyk


How are you going to ignore the .hgignore without an .hgignore file in the repositry to ignore it ;P

Seriously.. it should probably be in the repository, since the files to be ignored are respositry-specific; a user can of course specify their own ignores additionally in a file specified in their .hgrc

like image 1
James Avatar answered Oct 17 '22 18:10

James