Git and MAT files

17 views (last 30 days)
Moritz Ulmer
Moritz Ulmer on 30 May 2015
Commented: Joe Cosentino on 9 Jun 2020
Hi,
I'm using Git to manage a large number of small MAT files. To minimize the possibility of data loss, I always save all objects, even though most of them will not have changed. However since Git recognizes that the file has changed (due to the 'Platform/Created on' tag), a long list of changed files is presented when selecting them to be staged.
What possibilities exist to change Git's behaviour in such a way that it only shows the files as modified that have changes in their data?
Kind regards, Moritz
  3 Comments
Markus Leuthold
Markus Leuthold on 9 Jun 2020
is anybody aware of a git solution to ignore the first 70 bytes for comparison? Some pre-commit hook?
Joe Cosentino
Joe Cosentino on 9 Jun 2020
Do you absolutley need to use small MAT files to save your data? Consider transitioning your program to save the data as text, because GIT is better designed to work with text files, and you won't need to deal with changes in the header that are currently causing your issue. When trying to save objects of a matlab class, I usually just write my own "export to text file" method, and then provide an "import from text file" static method to load it back with the appropriate data.

Sign in to comment.

Answers (0)

Categories

Find more on Source Control Integration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!