To clarify, when I first ran this command, the following prompt was produced, which I chose "Yes" for, but this had no effect and a new MATLAB session is instead always opened when using the git-bash for windows.
How can I prevent a new MATLAB session from being opened when using mlDiff from git-bash (git for Windows)?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Apologies if this question is really a "git-bash" question. The problem in short is: when I use mlDiff.exe in cmd.exe on Windows, existing MATLAB sessions are used to lauch the difference window, which I expect and desire. However if I run the same command in git-bash on Windows, it always opens a new MATLAB session, which is undesirable.
git-bash is from a regular git installation (https://gitforwindows.org/ or https://git-scm.com/downloads)
Detail:
I'm using MATLAB's mlDiff.exe on Windows 7 (located at C:/Program Files/MATLAB/R2019b/bin/win64/mlDiff.exe) to compare two .mlapp files (though the file extension is irrelevant to this problem, the same problem is true for .txt and .m files, etc), following the documentation here. When using the command "C:/Program Files/MATLAB/R2019b/bin/win64/mlDiff.exe" PATHTOA PATHTOB in a cmd.exe window, everything works as I'd expected: any open MATLAB session is "used" to open MATLAB's file diff window (which naturally is done very quickly), and if no MATLAB session is open, one is opened and then the diff window also opened. This is also true is git diff is set up to use the above command for .mlapp files, and no issue is present when git diff is executed in cmd.exe.
However if I instead use a git-bash shell to run this command, a new MATLAB session is always opened, which is slow, and made worse as git diff calls this command for each file I want to compare, so as many sessions are opened as files compared. I am using git-bash because it is easier to use for other git operations, the state of the git repo is easier to see at glance, various bash commands are available to me. It was included in the installation of Git (for Windows) and is detected and can be chosen as the default shell for GitHub Desktop (from: https://desktop.github.com/).
4 Kommentare
Antworten (2)
stozaki
am 22 Jan. 2020
Bearbeitet: stozaki
am 22 Jan. 2020
Could you use "!" in the MATLAB command window?
for example
!git diff fileName
my result of example
>> !git diff lib.m
diff --git a/program/lib.m b/program/lib.m
index b97c00a..df3a439 100644
--- a/program/lib.m
+++ b/program/lib.m
@@ -1 +1,2 @@
-GGG
\ No newline at end of file
+GGG
+FFF
\ No newline at end of file
2 Kommentare
Markus Leuthold
am 9 Jun. 2020
I would also be interested in a proper solution of how to diff mat files. It would be nice to have a tool which allows to show equivalent mat files as identical (despite binary differences due to timestamps) and hence not as different files in git.
Siehe auch
Kategorien
Mehr zu Source Control finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!