Jupyter Notebook和Git无缝集成方案( 八 )

一般情况下 , 还可以定义一个smudge-filter来获取存储库内容 , 并对其进行一些处理以使其本地化 , 在这并不需要 , 可用cat命令用作占位符 。 我们希望所有git存储库中的Notebook默认进行数据清理 , 通过在用户配置文件~/.gitconfig文件设置:

[core

attributesfile = ~/.gitattributes_global

[filter \"nbstrip_full\"

clean = \"jq --indent 1 \\

'(.cells[
| select(has(\\\"outputs\\\")) | .outputs) = [
\\

| (.cells[
| select(has(\\\"execution_count\\\")) | .execution_count) = null \\

| .metadata = https://mparticle.uc.cn/api/{///"language_info\\\": {\\\"name\\\": \\\"python\\\" \\\"pygments_lexer\\\": \\\"ipython3\\\" \\

| .cells[

推荐阅读