git - nbstripout: what does `diff=ipynb` do in .gitattributes?
问题描述
I'm using nbstripout to remove Jupyter output before committing. nbstripout generated a .gitattribute
file that looks like this:
*.ipynb filter=nbstripout
*.ipynb diff=ipynb
This works as expected, whenever I git status
, git diff
, or git commit
, it doesn't include Jupyter outputs. However, when I remove the second line, it does the same thing.
What does *.ipynb diff=ipynb
do in this case?
解决方案
diff
属性,当设置为字符串时,引用差异驱动程序。
但是第一个属性使用相同的命令引用内容过滤器驱动程序。
由于在执行 git diff(通过 smudge 命令)时涉及到内容过滤器驱动程序,因此它执行相同的操作(意味着与索引相比,它会更改工作树文件的内容)
推荐阅读
- python - Turtle 中的主菜单
- algorithm - 压缩二进制文件
- plot - 如何扩展绘图边距以使 chorddiagram 不会剪切标签?
- oracle - 如何使用 macOS 在 SQLDeveloper 中创建用户?
- python - 如何对两个文件中的列进行求和和相乘?
- java - 在 findViewById(R.id.myListView) 上找不到符号
- reactjs - 如何使用标签式导航
- python - TypeError,send_mail() 缺少 1 个必需的位置参数:'recipient_list'
- php - PHP 7 升级未捕获的异常“错误”,消息“不能将字符串偏移量用作数组”
- javascript - Webpack:在 React Web App 中将文本作为 html 注入