Source Control Integration in MATLAB
You can use MATLAB® to work with files, folders, and projects under source control. You can perform operations such as commit, merge changes, and view revision history from the Files, Project, and Source Control panels.
Tip
Use the Source Control panel to work with multiple repositories at the same time. For more information, see Work with Multiple Repositories at Once.
MATLAB provides built-in integrations with Git™ and Subversion® (SVN).
To get started using Git source control in MATLAB, see Track Work Locally with Git in MATLAB and Collaborate Using Git in MATLAB.
To get started using SVN source control, see Work with Files Under SVN in MATLAB.
To integrate other source control tools such as Perforce® P4V with MATLAB, you can write a source integration using the Software Development Kit available on File Exchange. For more information, see Write a Source Control Integration with the SDK.
Work with Multiple Repositories at Once
Since R2025a
Use the Source Control panel to work with files in different source control repositories at
the same time.
If the Source Control icon is not in the sidebar, click the Open more panels
button and select the Source Control panel.
The Source Control panel automatically detects source control folders you are actively working on. If you do not have any folders or projects under source control, clone or checkout a repository using the Clone Git Repository or Check Out SVN Repository button.
A repository automatically appears in the Source Control panel when:
You change the current folder to the repository folder in the Files panel.
You expand a repository folder in the Files panel.
You open a project under source control.
You create a
matlab.git.GitRepository
object to manipulate a Git repository programmatically.You open the Branch Manager for a Git repository.
You enable annotation for a file under source control using the Blame View in the MATLAB Editor.
In the Source Control panel, you can see the modified and untracked files in every
active working folder, perform source control actions such as inspecting local
changes, adding files to source control or to .gitignore
files,
and discarding or committing changes. For more information, see Review and Commit Modified Files to Git.
From the Source Control panel, you can also open the Branch Manager to create, merge, and manage Git branches. For more information, see Resolve Git Conflicts.
Tip
You can open the Branch Manager for multiple Git repositories at the same time. This is useful when you work with Git submodules. For more information, see Work with Git Submodules in MATLAB.
This example illustration shows the Source Control panel with two active working folders, one under Git source control and one under SVN source control.
For every working folder, you can access more source control actions using the
More source control options button .
If the source control integration for a folder cannot start, the Source Control panel prints information to help the user fix the issue. This example illustration shows a Git integration that cannot start because the user does not have enough permissions to the folder that stores the repository.