Doubt about escaped characters in .stignore

In .stignore the pattern ‘#include’ has a special meaning, so it seems that a ‘#’ at the start of a rule is not an ordinary character. On the other hand, my editor (emacs) opens temporal files with names such as ‘#name#’ for recovery in case of a crash. I don’t want to synch, those so I added the rule #* to my .stignore files, and it seems to work all right. Nevertheless, I wonder if the ‘#’ should have been escaped somehow. What if I want to exclude a file named ‘#include’. What pattern would I have to use? ‘#include’? ‘#include’? I didn’t find about escaping characters in the documentation.

We handle lines starting with the string #include specifically. That means that some other #file can be matched just by it’s name, but not if it’s actually called “#include”. There is no escape character, so to match a file called #include you would need patterns like


where the first line matches “#include” at the top level, the second one matches “#include” at all other levels, and neither of the lines start with “#include” so they don’t trigger the include mechanism.

Thanks for the explanation! So I guess my #* is correct. Simple doubt about your answer: /#include includes the top level? ( in **/… matches empty strings?)