如果我new_file.txt使用 emacs 进行编辑,则会有临时文件,例如文件未保存和#new_file.txt#保存时。我想排除这些文件。所以我这样写:.#new_file.txtnew_file.txt~.gitignore
#This is a comment line
*~
[#]*[#]
.\#*
这非常有效。但后来我添加了一些注释行:
#This is a comment line
*~
[#]*[#] # this is a comment
.\#* # this is another comment
在 a 之后git status,我看到两者#new_file.txt#并被.#new_file.txt列为未跟踪文件。
我认为可能会对作为注释行开头的字符.gitignore感到困惑。#所以我删除了这两条注释行。但是,又一次,git status我仍然看到 并列为未跟踪的文件。#new_file.txt#.#new_file.txt
我愿意 :
git rm -r --cached .
正如".gitignore not working"中所建议的,但它没有帮助。
有人可以告诉我发生了什么,以及如何.gitignore按我的意愿工作吗?非常感谢你!