.idea文件夹如何取消版本控制

解决方法

# 先执行删除命令
$ git rm -r --cached ".idea"
# 提交到本地
$ git commit -m "del .idea file"
# 推送到远程仓库
$ git push -u origin "master"

这样处理完成后,下次同步的时候还会要求提交,所以需要在本地设置该文件夹的文件不同步,所以还得设置一下,在工程根目录下新建一个文件.gitignore,内容如下:

# Compiled class file
*.class
*.classpath
*.factorypath

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# IDE Files #
*.iml
.idea
.idea/
.project
.settings
target
.DS_Store

# temp ignore
*.cache
*.diff
*.patch
*.tmp

# Maven ignore
.flattened-pom.xml

然后将.gitignore提交

$ git add .gitignore
$ git commit -m "add .gitignore file"
$ git push -u origin "master"
posted @ 2024-02-07 16:29  Frodo1124  阅读(335)  评论(0编辑  收藏  举报