.hgignore not working for mercurial
Asked Answered
N

2

12

I use mercurial for php projects and my .hgignore file is not working. It's supposed to be placed in the .hg/ folder, isn't it?

.hgignore

/.hg/.hgignore file

# Allow *. syntax
syntax:glob

# Ignore these files
.hgignore
.htaccess
.hg/*
Nacred answered 26/2, 2010 at 5:43 Comment(0)
F
30

There is no mention in the .hgignore page of that file being inside .hg:

The .hgignore file sits in the working directory, next to the .hg folder.

And whatever file you want to ignore, you must be sure they are not already tracked. If they are, you need to remove them first, and then add them as private (non-tracked) file.

Fasciate answered 26/2, 2010 at 7:2 Comment(2)
aha yes! i supposed to make "Remove From Repository" for the files defined in .hgignore! just did it, and now it is fine! working well :) thanksNacred
To untrack a file without actually deleting it, hg forget <filename> is your friend!Larner
A
3

Just from memory I think .hgignore needs to live in the repository root. You certainly don't need to tell it to ignore the .hg folder, that will happen more or less automatically. Any reason why you don't want your ignore and access settings in your repo?

Ampereturn answered 26/2, 2010 at 5:56 Comment(4)
memory? i restarted mamp and mercurial... still same problem :/ i'm editing .htaccess file and mercurial is just taking the changes :/ ps, sorry but i didnt understand your questionNacred
Johannes Rudolph is correct. The .hgignore should go in your repository root, not in your .hg directory. Any files you've already added override .hgignore. Files can't be both tracked and ignored, and if tracked it overrides the ignoring. He's also correct that .hg doesn't need to be in the .hgignore file -- that's automatic.Callao
artmania: Mercurial stores these setting in .hgignore and .htacsess respectively. If you put them on the ignore list they won't be tracked by mercurial if they weren't added before.Ampereturn
@Ry4an: You're correct, feel free to edit my answer and add that important part.Ampereturn

© 2022 - 2024 — McMap. All rights reserved.