How to get rid of .pyc

Question:

I’ve been creating a Django app and I have a question about .pyc.
I don’t know exactly when, but I believe when I created a branch and moved into the branch, I always had a problem about .pyc. Three .pyc files always emerge to branch areas on VSCode.
enter image description here

I want to even delete the three files, but I don’t think it’s the best way to solve this. Or maybe I can’t delete them for another reason.

Asked By: Sana

||

Answers:

You can put these files in .gitignore. Add whatever you don’t want to push to git

*.egg
*.egg-info
*.bv
*.pyc
build
__pycache__
eggs

First add those three file names or provide extension like this *.xyz inside your .gitignore file and than run this command git rm --cached . to remove cached files and than push it to your branch

‘.’ represent all files in current directory if you want to remove
chache of perticular file than add file names like this git rm --cached file1 file2

Answered By: Ankit Tiwari
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.