Is it possible to have a local Mercurial ignore file? Apparently the .hgignore is a file versioned as any other file. Can I have such a file next to the versioned one?
Use a local . hgignore which you do not commit, and add whatever you want to it, placing . hgignore first.
The . hgignore file sits in the working directory, next to the . hg folder. It is a file versioned as any other versioned file in the working directory, which is used to hold the content of the ignore patterns that are used for any command operating on the working directory.
There are several cases here, so depending on the case you'll have different possible solutions:
.hgignore
file, you can:
.hgignore
to filter it, and.hgignore
if this is also useful for others (e.g., *.o, etc.) or you can leave the .hgignore
as local without commiting/pushing it, and in this case, you can even specify .hgignore
in .hgignore
as mentioned by msw so that your local version will also be ignored..hgignore
file that for some reason you do not want to use (commit and push), you can:
.hgignore
except it will stay local. You can declare this untracked ignore file either in your repo .hg/hgrc
or you global $HOME/.hgrc
(see the UI section doc)..hgignore
: any file that is already committed cannot be ignored! You can either:
hg forget
" the file (the opposite of "hg add
"), then do as the two first cases, or
use the "-X
" option as a default for status/diff/commit in your .hg/hgrc
configuration file, e.g.,Hope it'll help.
Yes you can configure a local, per-user ignore file. The location and name of this file is defined in the user-specific .hgrc
configuration file (usually located in the home directory of the user) under the [ui]
section, e.g.:
[ui]
ignore = ~/.myhgignore
This file should be in the same format as the repository-wide .hgignore
file.
Reference: http://www.selenic.com/mercurial/hgrc.5.html#ui
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With