Discuss / Git / 为什么添加了.gitigonore文件后输入git status,还在track我想要忽略的文件?

为什么添加了.gitigonore文件后输入git status,还在track我想要忽略的文件?

Topic source

我用Matlab写代码,每当修改代码的时候,Matlab会自动缓存.asv文件,我就想用.ignore的方法忽略这些.asv文件。我上网找了一个MATLAB.gitigonore文件(https://github.com/github/gitignore/blob/master/Global/MATLAB.gitignore),git add和git commit了这个文件。

但是输入git status之后,仍然显示

Untracked files:

  (use "git add <file>..." to include in what will be committed)

        mycode.asv

为什么git 还在track这个.asv文件啊?

我输入 git check-ignore -v *

根本没有任何反应

明白了。文件名不能叫MATLAB.gitigonore,而必须叫.gitignore

廖雪峰

#4 Created at ... [Delete] [Delete and Lock User]

它的意思是叫你把文件内容加到.gitignore里

一般来说,需要加Windows / Mac / Linux + 你的特定项目,都可以在这里找:

https://github.com/github/gitignore/tree/master/Global

懂了!谢谢廖老师!


  • 1

Reply