I don't want to commit my PyCharm config files (e.g. .idea/codeStyleSettings.xml) to my git repository, so I added the following to my .gitignore file:
.idea/ mydjangosite/.idea/
However, every time I try to make a commit within PyCharm (command k), it still wants to commit these files. How do I get PyCharm to recognize my .gitignore file and not commit these files?
If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a . gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.
You can create a . gitignore file in your repository's root directory to tell Git which files and directories to ignore when you make a commit. To share the ignore rules with other users who clone the repository, commit the . gitignore file in to your repository.
If you want to maintain a folder and not the files inside it, just put a ". gitignore" file in the folder with "*" as the content. This file will make Git ignore all content from the repository.
gitignore file in the VCS root directory, you can right-click anywhere in the Project window, choose New | File and type . gitignore in the New File dialog.
If PyCharm offers you to commit the files, it means that you have already added them to Git. You need to remove them using 'git rm --cached' and commit the change. After that, they will be ignored by the integration according to your .gitignore settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With