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

Walter Roberson
Walter Roberson 2015년 5월 30일
Note: .mat files contain a timestamp of when they were created, so files with identical content will not be binary identical. In cases where it was known that the same variables occur in the same order, ignoring about the first 70 bytes of the .mat and comparing the rest might work. But if the order differs then binary comparison will fail for identical variable content.
Markus Leuthold
Markus Leuthold 2020년 6월 9일
is anybody aware of a git solution to ignore the first 70 bytes for comparison? Some pre-commit hook?
Joe Cosentino
Joe Cosentino 2020년 6월 9일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Git in MATLAB에 대해 자세히 알아보기

질문:

2015년 5월 30일

댓글:

2020년 6월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by