Git 显示已修改的 *.ipynb 文件,无法重置、存储或切换分支

Git 显示已修改的 *.ipynb 文件,无法重置、存储或切换分支

我最近一直遇到这个重复出现的问题:

$ git status
On branch foo
Your branch is up to date with 'origin/foo'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   tools/notebook1.ipynb
        modified:   tools/notebook2.ipynb

$ git reset --hard
$ git status
On branch foo
Your branch is up to date with 'origin/foo'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   tools/notebook1.ipynb
        modified:   tools/notebook2.ipynb
$ git stash
$ git status
On branch foo
Your branch is up to date with 'origin/foo'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   tools/notebook1.ipynb
        modified:   tools/notebook2.ipynb

我所做的一切都无法消除已更改的文件,也git diff没有显示任何修改。

我如何才能 a) 找出导致此问题的非内容更改,以及 b) 在不执行并提交这些更改的情况下修复此问题?Fwiw,我正在repo 中git add使用,但这不应该影响之前的任何内容。pre-commitcommit

答案1

我发现一些配置看起来.git/config像这样

[filter "nbstripout"]
    clean = \"venv/python3\" -m nbstripout
    smudge = cat
[diff "ipynb"]
    textconv = \"venv/python3\" -m nbstripout -t

删除它们暂时解决了这个问题。

相关内容