我是git的新手,我不知道我做错了什么.我想运行git diff --name-only但我想要排除以.test结尾的文件,这意味着即使这些已经改变了,我也不希望git diff输出它已被更改.我试图将这些文件添加到.gitignore文件中,但是当我运行git diff命令时,所有这些都包括.gitignore!
我做错了什么以及如何在运行git diff时排除文件?
$ cat .gitignore
# OSX
*/.DS_Store
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
$ git status
On branch develop
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Assets/Sprites/.DS_Store
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
现在.gitignore和状态消息中有更多不相关的文件,但.gitignore本身未被修改,此版本已提交.
我该如何解决这个问题?