简体   繁体   English

如何摆脱.pyc

[英]How to get rid of .pyc

I've been creating a Django app and I have a question about.pyc.我一直在创建一个 Django 应用程序,我有一个关于 .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.我不知道确切的时间,但我相信当我创建一个分支并搬入该分支时,我总是遇到关于 .pyc 的问题。 Three.pyc files always emerge to branch areas on VSCode.三个 .pyc 文件总是出现在 VSCode 的分支区域。 在此处输入图像描述

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.或者我可能因为其他原因无法删除它们。

You can put these files in .gitignore .您可以将这些文件放在.gitignore中。 Add whatever you don't want to push to git添加任何你不想推送到 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.首先在.gitignore文件中添加这三个文件名或提供类似*.xyz的扩展名,然后运行此命令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表示当前目录中的所有文件,如果你想删除特定文件的缓存而不是像这样添加文件名git rm --cached file1 file2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM