I'm read all kinds of post on this and I just can't get it to work.
in my .ignore file I have
*/[Ll]ogs/*
Although I have tried about a dozen other variations, everything short of explicitly naming the file, I still am commiting these files
new file: src/methodfitness.web/Logs/Trace.log.2012-03-15
I also had a similar problem helping a co worker exclude his web.config file but that's his problem now, I just don't want these bloody log files.
thanks,
R
The pattern */[Ll]ogs/*
will only match a logs folder that's one level depe. Yours is 3 levels deep. You also said ".ignore file", I hope you meant ".gitignore". Anyway, you can fix this in one of four ways:
Change the pattern to src/*/[Ll]ogs/*
Put the pattern */[Ll]ogs/*
into src/.gitignore
instead of your root .gitignore
Change the pattern to just [Ll]ogs/
. This will ignore any directory called "Logs" or "logs" in your entire tree. This may not be appropriate if you only want to ignore a directory of this name within your specific domain folders.
Put the pattern *
into src/methodfitness.web/Logs/.gitignore
. This will ignore all files in that folder. The benefit of this approach is git will still create the Logs
folder when doing a checkout, which may or may not be something you want to happen. If you do this, make sure to explicitly add the .gitignore
file, or it will end up ignoring itself.
On a related note, the trailing *
is unnecessary. You can indicate directories with your ignore pattern and it will skip the entire directory. The only time when you want the trailing *
is if you need to be able to un-ignore specific files (using the prefix !
syntax, e.g. !*/[Ll]ogs/goodfile.txt
)
In order to ignore all log directories (and content too) at any deep inside your working copy you just have to read gitignore man mage and adopt example of ignoring foo dir from man-page.
For .gitignore in the root plain
logs/
pattern do the trick
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