根目录下有一个 .idea 文件夹,我已经在 根目录下的 .gitignore 文件中加入了
1 2 3 4 |
|
然后 git commit -m "ignore .idea dir" -> git push -u origin ->
但是远程的git 中还是有 .idea 这个目录。无法删除。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
1)如何才可以删除git中跟踪的 .idea目录但是又不删除本地的 .idea 文件夹?
2)是不是遇到文件夹中有. 这样特殊字符的,在.gitignore中需要转义?
我使用了 git rm -r --cached .idea 但是报错,删除不了。远程还在
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
世界只因有你2017-04-27 09:05:44
你要先去删除远程的 .idea 目录。
这种情况,你是在设计gitignore 之前就没考虑好的,现在的措施是:
rm -rf .idea (这样会删掉你本地的,不过你重新打开一次项目就有会自动给你生成了)
git add -A .
提交
git pull
pull 后再看看同步后,远程的删掉没有;如果本地有,再次重复下。
干净后,这下 git rm -r --cached .idea 取消跟踪
在push 吧
怪我咯2017-04-27 09:05:44
.gitignore
先不添加忽略的那行,直接删除 .idea
文件,然后提交.gitignore
里添加 .idea/*
.gitignore
,overPHPz2017-04-27 09:05:44
使用 git rm -fr .idea
删除本地.idea文件,
在.gitignore文件中添加.idea 进行过滤
保存后提交到远端,然后就发现已经清楚掉啦
迷茫2017-04-27 09:05:44
# 执行步骤如下:
先将来 .idea/ 添加到文件。ignore文件中。
2.删除本地。idea文件
3.git add 。
git commit -m "update .ignore file"
git push origin master
6.用本地的idea打开文件,会看到本地的.idea文件又回来了。