kynan / nbstripout

strip output from Jupyter and IPython notebooks
Other
1.19k stars 95 forks source link

windows command #83

Closed RoelantStegmann closed 5 years ago

RoelantStegmann commented 6 years ago
git filter-branch -f --tree-filter "for /r %i in (*.ipynb) do nbstripout %i --keep-count --keep-output"

Was wondering if anyone knows the correct windows syntax by heart: i keep getting errors :) Maybe we can add it to the readme afterwards?

kynan commented 6 years ago

I'm not a Windows user, so can't help unfortunately. Hopefully someone from the community knows the answer, maybe @ibressler ?

ibressler commented 6 years ago

The command given to --tree-filter is interpreted by bash. Therefore, it works like this: (Tested in Anaconda Prompt on Win10 which is a Windows command prompt with nbstripout/Python available but not having GIT in its %PATH%)

"c:\Program Files\Git\bin\git.exe" filter-branch -f --tree-filter "(IFS=$'\n'; for fn in $(find . -type f -name '*.ipynb'); do nbstripout \"$fn\" --keep-count --keep-output; done)"

The most outside parentheses (aka subshell) are required to encapsulate the IFS setting for supporting file names with spaces. Changing the IFS breaks the GIT filter-branch command otherwise.

kynan commented 6 years ago

Thanks @ibressler! @RoelantStegmann Does this answer your question?

kynan commented 5 years ago

@RoelantStegmann Friendly ping, can this be closed?

kynan commented 5 years ago

Assuming this has been answered. @RoelantStegmann please reopen if not.