Reputation: 326
I know there are many, many posts on this topic. I've tried all of the answers I can find and none of them seem to be addressing my problem.
I started a git project where unfortunately .pyc
files in __pycache__
directories were initially being tracked. I realised the problem and then put *.pyc
and __pycache__
in .gitignore, but of course they were still being tracked.
I then:
Tried to remove the tracked files:
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
Checked my .gitignore. The encoding, according to file -I .gitignore
, is .gitignore: text/plain; charset=us-ascii
. The .gitignore itself is:
__pycache__
*.pyc
buildSite/.DS_Store
*.DS_Store
.idea/
.idea/workspace.xml
scratchFiles
There aren't any extra whitespaces or anything.
I'm still getting .pyc files showing changes:
git status
...
modified: buildSite/builder/templatetags/__pycache__/class_tag.cpython-36.pyc
Very grateful for any suggestions!
Upvotes: 3
Views: 1690
Reputation: 1323353
Make sure:
.gitignore
file.git/
subolder) in any parent folder of your files to be ignored__pycache__/
, not __pycache__
.Upvotes: 4