小编典典

.gitignore 不忽略 .idea 路径

all

git为了忽略我的.idea/路径,我错过了什么?

ctote@ubuntu:~/dev/1$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

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:   .idea/.name
    modified:   .idea/misc.xml
    modified:   .idea/modules.xml
    modified:   .idea/vcs.xml
    modified:   .idea/workspace.xml
    modified:   src/Receiver.java
    modified:   test/1/agent/WindowsQueryHandlerTest.java

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

    lib/
    mp1.iml

no changes added to commit (use "git add" and/or "git commit -a")

ctote@ubuntu:~/dev/1$ cat .gitignore
*.class

# Package Files #
*.war
*.ear

# IDEA config files
.idea/

阅读 109

收藏
2022-09-02

共1个答案

小编典典

.gitignore只忽略新添加的(未跟踪的)文件。

如果您有已添加到存储库的文件,则将照常跟踪它们的所有更改,即使它们与 .gitignore 规则匹配。

要从存储库中删除该文件夹(而不从磁盘中删除它),请执行以下操作:

git rm --cached -r .idea
2022-09-02