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.
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/).