Main Content

Source Control in Projects

Configure source control, retrieve files, review changes, commit modified files

Projects help you to organize large modeling projects by finding required files, managing and sharing files and settings, and interacting with source control. Watch Using Projects to Collaborate, Track, and Merge Changes and Perform Code Reviews (4 min, 50 sec) and see What Are Projects? and About Source Control with Projects.

Functions

expand all

Create Repository

gitcloneClone Git repository (Since R2023b)
gitrepoCreate Git repository object (Since R2023b)
gitinitInitialize empty Git repository (Since R2023b)

Track Files

gitrepoCreate Git repository object (Since R2023b)
addMark new file for addition to Git repository (Since R2023b)
rmMark file for deletion from Git repository (Since R2023b)
status Display status of files in working folder and staging area in Git repository (Since R2023b)
logDisplay record of commits in Git repository (Since R2023b)

Manage Branches

gitrepoCreate Git repository object (Since R2023b)
createBranchCreate new Git branch (Since R2023b)
switchBranchSwitch Git branch (Since R2023b)
deleteBranchDelete local Git branch (Since R2023b)
mergeMerge Git branch, revision, or tag into current branch (Since R2023b)

Update Repository

gitrepoCreate Git repository object (Since R2023b)
fetchDownload new data from remote Git repository (Since R2023b)
mergeMerge Git branch, revision, or tag into current branch (Since R2023b)
pullDownload and merge new data from remote Git repository into local repository (Since R2023b)

Revert Changes

gitrepoCreate Git repository object (Since R2023b)
discardChangesDiscard changes in Git repository (Since R2024a)

Publish Changes

gitrepoCreate Git repository object (Since R2023b)
commitCommit changes to Git repository (Since R2023b)
pushPublish local changes to remote Git repository (Since R2023b)
currentProjectGet current project
listModifiedFilesList modified files in project
refreshSourceControlUpdate source control status of project files

Legacy API

simulinkproject(Not recommended) Open project and get project object

Topics

Source Control Setup

Retrieval and Checkout

Reviewing Changes and Committing Modified Files

Featured Examples