Tips for deleting the .idea folder from the git repository

This article mainly introduces a small coup to delete the .idea folder from the git repository. This article introduces you in detail, and has a certain reference value for everyone's study or work. Friends who need it can refer to it.

If you don't configure the .gitignore file, when you bring the push code, you will push unnecessary files to the remote warehouse, such as the .idea file. If this file appears accidentally in the remote warehouse, you can delete this file through the following steps:

1. Configure the .gitignore file (new/edit)

echo '.idea' >> .gitignore

2. Upload the .gitignore file to the remote warehouse

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

3. Delete the .idea file of git

git rm --cached -r .idea

4. Sync to remote warehouse

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

After completion, you can find that the .idea file in the git repository has been deleted, and the push code will no longer upload the .idea file afterwards.

PS: I am using PyCharm to write python code, usually through new -> .ignore file -> .gitignore file to automatically generate a .gitignore file.

The following is a brief configuration of my commonly used .gitignore files:

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

This concludes this article on the tips for deleting the .idea folder from the git repository.

Guess you like

Origin blog.csdn.net/yaxuan88521/article/details/113788810