Clear Filters
Clear Filters

MATAB File revisions are out of order

1 view (last 30 days)
Nickolai Belakovski
Nickolai Belakovski on 8 Jul 2022
Answered: arushi on 28 Dec 2023
When right clicking on a file in MATLAB that's tracked by git and going to "Source Control -> Show Revisions" MATLAB appears to be sorting the commits by date, as opposed to looking at parent commits. Dates can be misleading as they can be modified by rebases or even on purpose (and there's also the difference between AuthorDate and CommitDate, MATLAB appears to be using the former even though the latter looks like it's slightly better, even if it's not as good as using the parent commit).
This causes confusion when comparing against older revisions. Is this a known bug and/or is there a fix or a workaround?

Answers (1)

arushi
arushi on 28 Dec 2023
Hi Nickolai,
I understand that you are facing confusion when comparing against older revisions. MATLAB integrates with Git for source control, providing a basic set of features directly within the MATLAB environment. However, MATLAB's source control interface is not as comprehensive as dedicated Git clients or command-line tools.Here are a few workarounds you could consider:
  1. MATLAB Command Window: You can use Git commands directly in MATLAB's Command Window by prefixing them with an exclamation mark ! to access the system shell.
  2. Use a Dedicated Git Client: For more advanced Git operations and accurate commit history visualization, you can use a dedicated Git client (like GitKraken, SourceTree, or even the command-line interface). These tools provide a more accurate representation of the commit graph and allow for more complex operations.
  3. External Scripting: Write a script (in Bash, Python, etc.) that uses Git commands to fetch the commit history in the desired format. You can then call this script from MATLAB if needed.
Link to the documentation of using Git with MATLAB - https://www.mathworks.com/help/matlab/matlab_prog/use-git-in-matlab.html
Hope this helps.
Thank you

Categories

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

Tags

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!