Reputation: 12896
I use the Jupyter 4.1.
I've found the results of the cells are also saved into the ipynb
file. Can I disable it? I want manage it with Git.
For example, there is a cell of my notebook,
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"autoscroll": "json-false",
"collapsed": false,
"ein.tags": [
"worksheet-0"
],
"slideshow": {
"slide_type": "-"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2016-08-04 : 749591\n",
"2016-08-05 : 447416\n",
"2016-08-06 : 305969\n",
]
}
],
"source": [
"curidx = (data.cur_day - data.start_day).days\n",
"for iday in range(curidx, data.nday):\n",
" day = data.cur_day + dt.timedelta(iday - curidx)\n",
" print \"%s : %d\"%(day, int(pdata.barCn[iday]))\n"
]
}
I don't want the contents of the outputs to be saved.
Upvotes: 12
Views: 3020
Reputation: 12896
Thanks @Thomas K, guided by his advice, I've found the solution that is use the nbstripout. The usage is below
nbstripout --install
to install a git attribute filter which will strip out the outputs from the ipynb file when it's added to the git cache.Upvotes: 14