Main Content

Collaborate Using Git in MATLAB

You can use Git™ source control in MATLAB® to manage your files and collaborate with others. Using Git, you can track changes to your files and recall specific versions later. From the MATLAB Files and Project panels, you can clone an existing remote repository, add files to the local repository, commit changes, and push and pull changes to and from the remote repository.

After you clone a remote Git repository, you can use the Source Control panel to work with and manage multiple repositories at the same time.

Side bar in MATLAB showing the Files, Project, and Source Control icons

To work with files in a remote repository, follow these steps:

  1. Pull the latest changes from the remote repository.

  2. Edit the existing files in your working folder.

  3. Mark new files for addition to the local repository.

  4. Review the changes.

  5. Commit the modified files to the local repository.

  6. Push changes to the remote repository.

Basic Git workflow

Alternatively, to track changes to your files without sharing with others, you can create a local Git repository that is not synced with a remote repository. You follow similar steps when working with a local repository that is not synced with a remote repository, but you omit the Pull and Push steps. For more information, see Track Work Locally with Git in MATLAB.

Note

Before using Git in MATLAB, set up your system to avoid binary file corruption. For more information, see Set Up Git Source Control.

To collaborate with others using Git in MATLAB, follow the instructions in these examples:

Use the files provided within each example to follow the instructions.