Mercurial: Globally Ignore Files

11,092

Solution 1

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

Solution 2

In powershell, you can get to your global files like this.

PS> notepad $env:userprofile/mercurial.ini
...
[ui]
ignore = %USERPROFILE%\.hgignore
...

PS> notepad $env:userprofile/.hgignore
/bin/
/obj/
Share:
11,092
mikeycgto
Author by

mikeycgto

Updated on August 12, 2022

Comments

  • mikeycgto
    mikeycgto almost 2 years

    I know about .hgignore and how I can ignore files on a project-by-project basis. I want to ignore stuff for all Mercurial repositories.

    Is there something I can stick in .hgrc? Or put a .hgignore in my $HOME path (I tried that already but maybe I did something wrong).

  • Ry4an Brase
    Ry4an Brase almost 13 years
    The tilda will work on window too -- mercurial interpolates it to USERPROFILE for you.
  • Joel B Fant
    Joel B Fant over 12 years
    @zerkms: Seems that site expired almost a month ago. :/
  • zerkms
    zerkms over 12 years
    @Joel B Fant: it's sad :-( there were a lot of good patterns for different kind of projects
  • brianmearns
    brianmearns about 9 years
    Just FYI, ~/.hgignore seems to work on Windows as well, at least with Windows 7 mercurial version 3.0.2. It works the same as the %USERPROFILE% macro listed in the answer.