-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use nbdime to only commit code cell changes? #410
Comments
Thanks for the update. Using a filter is indeed the right way to go. I think it will be hard to automatically resolve a merge between a version which is cleaned and one that is not. If you could break down the logic of how you imagine that working, maybe we can find a solution. |
I was talking about the case where a local notebook has changes in fields that aren't under git (i.e. those fields that get nbstripped out before commit) (e.g. execution_count). But I think before I can figure out the logic, I need to get out the basic conflicts out of the way. Consider
This shouldn't happen, since Once I disable nbstripout filter the above workflow does work. I think what I'm trying to do is find a way around the conflict with filters and merging. Specifically if 'git pull' tells me:
I'd like to run nbmerge to do the merge right after Can you see such a way? Thank you. I found a document that also talks about how to overcome this conflict by constantly installing/uninstalling nbsrtripout https://lightlab.readthedocs.io/en/master/_static/misc/mergeWithNotebooks.html |
This is more of a git issue than an issue of nbdime, so you might have more luck trying in another forum (e.g. stackoverflow). That being said, I can think of two ways to deal with your stashing issue:
|
I posted on SO as you suggested. Thank you for the suggestions, but neither of them works.
|
BTW: What happens if you use the command |
Also, did you try asking on the nbstripout repo? |
Not yet, I'm going to spend a bit more time trying to debug it, and if all fails then will ask there next. Thank you for your continuous support, Vidar. |
At least this should work, I think:
|
Nope:
|
Closing as this isn't really an nbdime issue. If you end up with any suggestions for changes to nbdime behavior to accommodate what you are trying to do, I'd be happy to reopen it! |
PS: Did you open an issue on nbstripout? If so, would you mind cross-referencing it (linking it) here? |
Not yet. I re-implemented nbstripout and I haven't re-encountered this issue so far. If I do, I will certainly cross-post any new developments here. |
FYI, we're discussing adding a dedicated |
I have nbdime configured to be used as a driver for 'git diff' and 'git merge':
and I have nbdime configured to ignore all but code cells: (
~/.jupyter/nbdime_config.json
):so now when I do 'git diff' I get:
which is perfect.
Now, the notebook under git control has everything committed (outputs, metadata, etc.). I want git to ignore any changes in outputs, metadata and details and commit only changes in code cells, exactly as it's shown in 'git diff' (via nbdime configured to only diff code cells).
How can I commit just the code changes?
I tested what I have now and I get all changes committed, not just code cells.
One way nbdime could do that is to:
but I don't know how to make nbdime to do that (or perhaps it does it already).
and I realize that the diff might not apply, if there are cells that were added and removed, so perhaps this is not an option at all.
edit: So we ended up using nbstripout to remove all but what's needed to be stored under git. Next is to figure out how to do automated merging a stripped out notebook under git with the local unstripped out notebook. I was thinking that perhaps nbmerge could mirror nbstripout's logic and be able to automatically merge the two, knowing which cells are important and need to be merged and which cells can be ignored.
Thank you.
The text was updated successfully, but these errors were encountered: