5

从git仓库中删除.idea文件夹

 3 years ago
source link: http://www.blogjava.net/yangjunwei/archive/2021/01/14/435773.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

从git仓库中删除.idea文件夹

如果不配置.gitignore的文件,带push代码的时候就会把一写不必要的文件push到远程仓库,如.idea文件。如果不小心出现此文件在远程仓库可以通过一下步骤delete此文件:

1.配置.gitignore文件(新建/编辑)

echo '.idea' >> .gitignore

2.将.gitignore文件上传到远程仓库

git pull git add .gitignore git commit -m 'edit .gitignore' git push origin master

3.删除git的.idea文件

git rm --cached -r .idea

4.同步到远程仓库

git commit -m 'delete .idea' git push origin master

完成之后就可以发现git仓库中的.idea文件已经被删除,而且之后push代码也不会再把.idea文件上传。

PS:我在使用PyCharm编写python代码,一般是通过new -> .ignore file -> .gitignore file 自动生成.gitignore文件。
下面是我自己比较常用的.gitignore文件简短配置:

.project .settings/ .prefs .pydevproject .idea/ .idea .DS_Store .cache *.pyc *.html *.xlm

posted on 2021-01-14 15:15 杨军威 阅读(10) 评论(0)  编辑  收藏


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK