我把这个添加到.gitignore file
.idea/*
但无论如何状态是:
# modified: .gitignore
# modified: .idea/.generators
# modified: .idea/dovezu.iml
# modified: .idea/misc.xml
# modified: .idea/workspace.xml
我究竟做错了什么 ?
我什至将 .idea/* 添加到全局~/.gitignore_global但 git status 无论如何都告诉我:
# modified: .gitignore
# modified: .idea/.generators
# modified: .idea/dovezu.iml
# modified: .idea/misc.xml
# modified: .idea/workspace.xml
Your .gitignore
正在工作,但它仍然跟踪文件,因为它们已经在索引中。
要阻止这种情况,你必须这样做:git rm -r --cached .idea/
当您提交.idea/
目录将从您的 git 存储库中删除,并且以下提交将忽略.idea/
目录。
PS:你可以使用.idea/
代替.idea/*
忽略目录。您可以在以下位置找到有关图案的更多信息the .gitignore手册页 http://linux.die.net/man/5/gitignore.
有用的引用来自git-rm
手册页
--cached
Use this option to unstage and remove paths only from the index.
Working tree files, whether modified or not, will be left alone.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)