我最近一直遇到这个重复出现的问题:
$ 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-commit
commit
答案1
我发现一些配置看起来.git/config
像这样
[filter "nbstripout"]
clean = \"venv/python3\" -m nbstripout
smudge = cat
[diff "ipynb"]
textconv = \"venv/python3\" -m nbstripout -t
删除它们暂时解决了这个问题。