I\'m trying to .gitignore emacs temporary/autosave files. I\'m using...
\\.\\#.*
in my .gitignore.
But git add -A
run in
gitignore doesn't use regular expressions. Instead it uses shell glob patters. The man page tells you two things important for this situation:
Otherwise, Git treats the pattern as a shell glob suitable for
consumption by fnmatch(3) with the FNM_PATHNAME flag.
and
A line starting with # serves as a comment. Put a backslash ("\")
in front of the first hash for patterns that begin with a hash.
This means that the pattern you want to use is simply .#*
.
Now the second pattern that matov mentioned, #*
, doesn't do anything as it is treated as a comment by git. Hence me quoting that second sentence from the man page.