1
我删除了一个文件path/to/the/file.cpp
,它是从git存储库顶部的相对路径,但我想要那个文件被git status
忽略。如何使用.gitignore来忽略文件
尝试在.gitignore
文件中放入以下模式,但似乎它们都不起作用。
**/file.cpp
file.cpp
path/to/the/file.cpp
任何想法?谢谢。
我删除了一个文件path/to/the/file.cpp
,它是从git存储库顶部的相对路径,但我想要那个文件被git status
忽略。如何使用.gitignore来忽略文件
尝试在.gitignore
文件中放入以下模式,但似乎它们都不起作用。
**/file.cpp
file.cpp
path/to/the/file.cpp
任何想法?谢谢。
这就是你一定要
git rm path/to/the/file.cpp
,现在当你混帐忽略应该工作
的.gitignore
path/to/the/file.cpp
正如马蒂Virkkunen指出,您的文件必须有已经被git跟踪了。
什么“不成功”的意思是?他们肯定会工作。 – zerkms 2014-11-25 03:03:11
Git已经跟踪了*这个文件吗?(即,您之前是否添加并提交过)?它会继续显示在'git status'中,直到您提交删除。 '.gitignore'只隐藏未跟踪的文件。 – 2014-11-25 03:06:21
@MattiVirkkunen该文件已被git跟踪。根据你的描述,似乎我不能达到我想要的 - 我想让git忽略我删除了已经在repo中提交的文件..声音奇怪?也许。但我这是我想要的原因.. – pierrotlefou 2014-11-25 04:47:55