Here’s the gitignore to remove config files in Pycharm

.idea/
/**/__pycache__/
/**/.DS_Store


If we forget to add gitignore at first, we could remove all the tracked but unwanted files by this answer

git rm -r --cached .