.gitignore不会忽略.ideapath
为了让git
忽略我的.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
只会忽略新添加(未跟踪)的文件。
如果您有已经添加到存储库的文件,他们的所有更改将像往常一样被跟踪,即使它们与.gitignore规则相匹配。
要从存储库中删除该文件夹(不从磁盘上删除),请执行以下操作:
git rm --cached -r .idea
添加.idea/
到.gitignore文件
在terminal中运行这个命令来完成任务:)
git rm -rf .idea git commit -m "delete .idea" git push
对于那些你变得fatal: pathspec '.idea' did not match any files
与w0lf的答案fatal: pathspec '.idea' did not match any files
:
你只需要包含.idea文件夹的完整path。
所以首先,做一个git status
,它应该告诉你path.idea
给定你现在在哪里。
然后,在命令w0lf中包含build议的path: git rm --cached -r example/path/to/.idea