如果我编辑new_file.txt
使用 emacs,会有临时文件,例如#new_file.txt#
and .#new_file.txt
当文件未保存时,以及new_file.txt~
保存时。
我想排除这些文件。所以我写我的.gitignore
像这样:
#This is a comment line
*~
[#]*[#]
.\#*
这非常有效。但后来我添加了一些注释行:
#This is a comment line
*~
[#]*[#] # this is a comment
.\#* # this is another comment
After a git status
,我都看到了#new_file.txt#
and .#new_file.txt
被列为未跟踪的文件。
I think .gitignore
可能会感到困惑#
字符作为注释行的开头。所以我删除了这两行注释。然而,继又git status
,我还是看到了#new_file.txt#
and .#new_file.txt
列为未跟踪的文件。
I do :
git rm -r --cached .
如建议的“.gitignore 不工作” http://www.randallkent.com/development/gitignore-not-working,但这没有帮助。
有人可以告诉我发生了什么事以及如何做.gitignore
工作如我所愿?非常感谢!
评论.gitignore
文件必须位于自己的行上 - 文件模式后面的任何注释都被解释为该模式的一部分。
将您的注释移至模式之前的行,它应该返回到其初始行为。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)