problems with .bzrignore

Kent Gibson warthog618 at
Wed May 6 05:11:22 BST 2009

John Arbash Meinel wrote:
> Tim Michelsen wrote:
> > Hello,
> > I would like to exclude the follwing files from my repository:
> > something.txt~
> > something.log
> > here is my ignore pattern:
> > *.~
> > *.*~
> > doc/sphinx-build.log
> > You can see this here:
> >
> > Please tell me why bzr does include these file in my repository:
> >
> > What is wrong with my pattern?
> As near as I can tell, your pattern is fine. Just as a guess, did you
> already 'bzr add' those files? Explicitly versioning a file always takes
> precedence over an ignore rule.
> If that is so, you should be able to do "bzr rm --keep something.txt~".
> And then the file will switch to 'unversioned', and thus 'ignored'.
> John
> =:->
I agree completely with what John says above.
You might also want to remove some of the redundancy from your
.bzrignore file.
For example both these patterns


are redundant since you already have


And both these patterns


will match the same files as these rules:


The regex rule alone should be sufficient, since it is a superset of all
the others.

I'd also tend to replace rules like these:





unless there are many more log files you do want to version control,
than those you don't.

As well as making your .bzrignore more convoluted than it needs to be,
all your duplicate rules will slow bzr down a little, since it has more
patterns to check.  Where possible, a few generic rules are better than
a lot of specific rules.

As to how you got this problem, it looks like you've had problems with
users explicitly adding files to bzr, then trying to have them ignored
by adding rules to .bzrignore, and when that didn't work adding another...
Some of that has been cleared up by the offending file being removed
from bzr, and some, as per your docs_contrib.rst~ example are still
floating around.


More information about the bazaar mailing list