Documentation

Add a Project to Source Control

Add a Project to Git Source Control

If you want to add version control to your Simulink® project files without sharing with another user, it is quickest to create a local Git™ repository in your sandbox.

  1. On the Simulink Project tab, in the Source Control section, click Use Source Control.

  2. In the Source control information dialog box, click Add project to source control.

  3. In the Add to Source Control dialog box, in the Source control integration list, select Git to use the Git source control integration provided by Simulink Project.

  4. Click Convert to finish adding the project to source control.

    Git creates a local repository in your sandbox project root folder. The project runs integrity checks.

  5. Click Open Project to return to your project.

    The Project node displays the source control name Git and the repository location Local Repository: yoursandboxpath.

  6. Select the Modified Files view and click Commit to commit the first version of your files to the new repository.

    In the dialog box, enter a comment if you want, and click Submit.

You need some additional setup steps only if you want to merge branches with Git. See Install Command-Line Git Client.

Tip

If you want to use Git and share with other users:

Add a Project to SVN Source Control

Caution

Before you start, check that your sandbox folder is on a local hard disc. Using a network folder with SVN is slow and unreliable.

This procedure adds a project to the built-in SVN integration that comes with Simulink Project. If you want to use a different version of SVN, see Set Up SVN Source Control.

  1. On the Simulink Project tab, in the Source Control section, click Use Source Control.

  2. In the Source control information dialog box, click Add project to source control.

  3. In the Add to Source Control dialog box, leave the default Source control integration selected to use Built-In SVN Integration.

  4. Next to Repository path, click Change.

  5. In the Specify SVN Repository URL dialog box, select an existing repository or create a new one.

    • To specify an existing repository, click Generate URL from folder to browse for your repository, paste a URL into the box, or use the list to select a recent repository.

    • To create a new repository, click Create an SVN repository in a folder . Using the file browser, create a folder where you want to create the new repository and click Select Folder. Do not place the new repository inside the existing project folder.

      Simulink Project creates a repository in your folder, and you return to the Specify SVN Repository URL dialog box. The URL of the new repository is in the Repository URL box, and the project automatically selects the trunk folder.

    Caution

    Specify file:// URLs and create new repositories for single users only. For multiple users, see Share a Subversion Repository.

  6. Click Validate to check the path to the selected repository.

    When the path is valid, you can browse the repository folders. For example, select the trunk folder, and verify the selected URL at the bottom of the dialog box, as shown.

  7. Click OK to return to the Add to Source Control dialog box.

    If your repository has a file URL, a warning appears that file URLs are for single users. Click OK to continue.

  8. Click Convert to finish adding the project to source control.

    The project runs integrity checks.

  9. After the integrity checks run, click Open Project to return to your project.

    The Project node displays details of the current source control tool and the repository location.

  10. If you created a new repository, select the Modified Files view and click Commit to commit the first version of your files to the new repository. In the dialog box, enter a comment if you want, and click Submit.

Caution

Before using source control, you must register model files with your source control tools to avoid corrupting models. See Register Model Files with Subversion.

Related Examples

More About

Was this topic helpful?