Check if Git is available by using the command !git in MATLAB. If Git is not available,
install it. After you have installed a command-line Git client and registered your files as
binary, you can use the merging features of Git in MATLAB.
On Windows:
(^1) Download the Git installer and run it. You can find command-line Git at:
https://msysgit.github.io/
(^2) In the section on adjusting your PATH, choose the install option to Use Git from the
Windows Command Prompt. This option adds Git to your PATH variable, so that
MATLAB can communicate with Git.
(^3) In the section on configuring the line-ending conversions, choose the option
Checkout as-is, commit as-is to avoid converting any line endings in files.
4 To avoid corrupting binary files, before using Git to merge branches, register the
binary files.
On Linux, Git is available for most distributions. Install Git for your distribution. For
example, on Debian®, install Git by entering:
sudo apt-get install git
On Mac, on Mavericks (10.9) or above, try to run git from the Terminal. If you do not
have Git installed already, it will prompt you to install Xcode Command Line Tools. For
more options, see https://git-scm.com/doc.
Register Binary Files with Git
If you use third-party source control tools, you must register your MATLAB and Simulink
file extensions such as .mlx, .mat, .fig, .mdl, and .slx as binary formats. If you do
not register the extensions, these tools can corrupt your files when you submit them by
changing end-of-line characters, expanding tokens, substituting keywords, or attempting
to automerge. Corruption can occur whether you use the source control tools outside of
MATLAB or if you try submitting files from MATLAB without first registering your file
formats.
Also check that other file extensions are registered as binary to avoid corruption at check-
in. Check and register files such as .mdlp, .slxp, .sldd, .p, MEX-
files, .xlsx, .jpg, .pdf, .docx, etc.
32 Source Control Interface