>  Q&A  >  본문

.gitignore下面制定了*.pyc但是无效?

我在git的根目录下面新建了一个.gitignore文件,然后添加了以下的内容

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

但是如果我现在修改了一个.py文件,编译后用git status查看

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   views.py
    modified:   views.pyc

no changes added to commit (use "git add" and/or "git commit -a")

请问应该怎么解决这个问题,让git忽视.pyc文件的修改

高洛峰高洛峰2873일 전841

모든 응답(1)나는 대답할 것이다

  • 三叔

    三叔2016-11-08 12:36:27

    看日志是已经提交过.pyc,把.pyc在git上删掉即可

    회신하다
    0
  • 취소회신하다