There are some well-known options for preventing the front end from adding "unnecessary" stuff to .nb files when keeping them e.g. in a git repository: CreateCellID, "FileOutlineCache" and "TrackCellChangeTimes".

However, recent Mathematica versions seem to add an ExpressionUUID to each cell, which makes the task of keeping .nb files in a repository more challenging.

So is there perhaps some dedicated option to turn that off and therefore get rid of ExpressionUUID in a given notebook?

Edit: Here is an example of a notebook created with Mathematica 12.0 that contains ExpressionUUID

  • 2
    $\begingroup$ You can post-process the files using this tool. I was able to install it pretty easily and confirm it does remove the cell metadata $\endgroup$
    – Jason B.
    Jan 29, 2020 at 18:20
  • 4
    $\begingroup$ One thing you can do is write a .wl rather than a .nb. $\endgroup$
    – evanb
    Jan 29, 2020 at 18:21
  • $\begingroup$ There are cases where one has to stick to .nb files, e.g. for packet documentation. With the 3 above mentioned options it worked quite well with Mma 10.4 and git without any extra tools. So I still sort of hope for a hidden option to get rid of those pesky ExpressionUUID. $\endgroup$
    – vsht
    Jan 29, 2020 at 22:11
  • 2
    $\begingroup$ @vsht, no you cannot control the presence off ExpressionUUIDs. $\endgroup$
    – ihojnicki
    Feb 3, 2020 at 15:15
  • 1
    $\begingroup$ @ihojnicki Hmm, I understand that ExpressionUUID might be required for some future functionality, but on the other hand it makes it even more difficult to keep notebooks in git repositories. I also sent a suggestion to introduce "git friendly" notebooks, perhaps as a separate datatype with reduced functionality. In any case, thanks for your reply. I guess I'll stick to the filter solution and try to integrate it as a git hook in my repo. Otherwise maintaining documentation will become even more inconvenient than it is now. $\endgroup$
    – vsht
    Feb 3, 2020 at 20:58

2 Answers 2


There is ResourceFunction["SaveReadableNotebook"]:

SaveReadableNotebook can be used to create notebook files that are well suited for version control systems that look at changes to files on a line-by-line basis.

It is better to use it with the option "ExcludedCellOptions":

ResourceFunction["SaveReadableNotebook"]["original.nb", "original_readable.nb", 
  "ExcludedCellOptions" -> {CellChangeTimes, ExpressionUUID, CellLabel}];

The formatted notebook file still opens normally:


One work-around (which I use) is to store your core Mathematica programming in *.m files---using a text editor to modify the files---and load them into Mathematica notebooks, as needed.

I do keep Mathematica notebooks in git as well, but looking at diffs or anything like that is hopeless.

  • $\begingroup$ Interesting idea! Regarding the original reason for my question (storing documentation notebooks for FeynCalc in git), we decided to abandon Mma documentation center and switch to Markdown at some point in the future (probably for the next release). The M2MD package by @Kuba makes it easy to produce high quality MD from .m files, e.g. as here $\endgroup$
    – vsht
    Aug 20, 2020 at 11:31
  • $\begingroup$ @vsht FeynCalc/FeynArts ... that brings back old memories! I used them back in graduate school (1990's) for something or other. $\endgroup$ Aug 21, 2020 at 2:29
  • $\begingroup$ Well, I started to contribute to FeynCalc during the grad school :) $\endgroup$
    – vsht
    Sep 15, 2020 at 8:40
  • $\begingroup$ There is a palette to compare notebooks. Not perfect but it is sure better than trying to use a regular diffs on notebooks: reference.wolfram.com/language/AuthorTools/tutorial/… $\endgroup$ Jun 15, 2022 at 14:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.