.gitignore不会忽略.idea路径 [英] .gitignore not ignoring .idea path

查看:1605
本文介绍了.gitignore不会忽略.idea路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

pre $ code $ ctote @ ubuntu:〜/ dev / 1 $ git status
分支主
您的分支与'origin / master'是最新的。

没有为commit提交更改:
(使用git add< file> ...更新将提交的内容)
(使用git checkout - < ; file> ...放弃工作目录中的更改)

修改:.idea / .name
修改:.idea / misc.xml
修改:.idea / modules.xml
修改:.idea / vcs.xml
修改:.idea / workspace.xml
修改:src / Receiver.java
修改:test / 1 / agent / WindowsQueryHandlerTest.java

未记录的文件:
(使用git add< file> ...来包含将要提交的内容)

lib /
mp1.iml

没有更改添加到提交中(使用git add和/或git commit -a)






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

#程序包文件#
* .war
* .ear

#IDEA配置文件
.idea /


解决方案

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



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



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

  git rm --cached -r .idea 


What am I missing that needs to be done in order to get git to ignore my .idea/ path?

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/

解决方案

.gitignore only ignores newly added (untracked) files.

If you have files that have already been added to the repository, all their changes will be tracked as usual, even if they are matched by .gitignore rules.

To remove that folder from the repository (without deleting it from disk), do:

git rm --cached -r .idea

这篇关于.gitignore不会忽略.idea路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆