add #*# glob to .gitignore?

后端 未结 4 628
礼貌的吻别
礼貌的吻别 2020-12-13 07:45

I want to add emacs autosave files to my .gitignore with the glob #*# but of course, lines starting with a hash are comment lines.

How can I get this in

相关标签:
4条回答
  • 2020-12-13 08:38

    This worked for me.

    *[#]*[#]
    *[#]*
    

    @CharlesStewart was close but did not work for sub-directory files which had autosave generated files.

    0 讨论(0)
  • 2020-12-13 08:39

    This doesn't exactly answer your question, but I think it may solve more problems than just this one symptom:

    You can move the autosave and backup files into a completely different directory so that your source directories don't get cluttered.

    0 讨论(0)
  • 2020-12-13 08:46

    Another way of escaping # is to use the character set syntax, so that your #*# glob becomes

     [#]*[#] 
    

    in your .gitignore file.

    0 讨论(0)
  • 2020-12-13 08:50

    Did you try

    \#*#
    

    Since 1.6.2, \ should be supported in .gitignore (see this patch)

    To be precise, 1.6.2.1 (March 2009)

    .gitignore learned to handle backslash as a quoting mechanism for comment introduction character "#".

    0 讨论(0)
提交回复
热议问题