git 在切换分支时候,提示       

        modified:   /Server/models/similar/__pycache__/config.cpython-36.pyc
        modified:   /Server/models/similar/__pycache__/predictor.cpython-36.pyc
        modified:   /Server/models/similar/__pycache__/similar_model_manager.cpython-36.pyc
        modified:   /Server/util/__pycache__/answer.cpython-36.pyc
        modified:   /Server/util/__pycache__/config.cpython-36.pyc

1.首先在.gitignore里面加入 __pycache__/ 

还是提示

Please move or remove them before you can switch branches.

使用以下终极大招,

注意!注意!注意!会把所有不是git跟踪的文件全部删除,比如你的环境 venv文件夹放外面。

git clean -d -fx ""

注:
1. x :表示删除忽略文件已经对git来说不识别的文件
2. d: 删除未被添加到git的路径中的文件
3. f: 强制执行

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐