You can use MATLAB® to add source control to files in a folder. If you want to add version control to your files without sharing with another user, it is quickest to create a local Git™ repository in your sandbox.
To use a Git server for your remote repository, you can set up your own Apache™
Git server or use a Git server hosting solution. If you cannot set up a server and must use a remote repository via the file system using the file:///
protocol, make sure that it is a bare repository with no checked out working copy.
For SVN, check that your sandbox folder is on a local hard disk. Using a network folder with SVN is slow and unreliable.
Before using source control, you must register binary files with your source control tools to avoid corruption. See Register Binary Files with SVN or Register Binary Files with Git.
To check out an existing SVN repository, see Check Out from SVN Repository. To clone an existing remote Git repository, see Clone from Git Repository.
Right-click in the white space (any blank area) of the MATLAB Current Folder browser. Select Source Control > Manage Files.
In the Manage Files Using Source Control dialog box, in the Source control integration list:
For an SVN repository, select Built-In SVN Integration
.
For a Git repository, select Git
.
Click the Change button to open the Specify SVN Repository URL dialog box if you are using SVN or the Select a Repository dialog box if you are using Git.
If you are using Git, you can change the repository URL after the repository is created. In the Current Folder browser, in a folder under source control, right-click and select Source Control > Remote and specify a new URL.
Click the Create a repository button to create a repository on disk.
Select an empty folder or create a new folder in which you want to create the repository and click Select Folder to create the repository.
For SVN, the URL of the new repository is in the Repository URL box, and the trunk
folder is selected. Specify file://
URLs and create new repositories for single users only. For multiple users, see Share a Subversion Repository.
In the Specify SVN Repository URL (SVN) or Select a Repository (Git), click Validate to check the path to the selected repository, and then click OK.
If your SVN repository has a file URL, a warning appears that file URLs are for single users. Click OK to continue.
In the Manage Files Using Source Control dialog box, choose the location for your sandbox, and then click Retrieve.
For an SVN sandbox, the selected folder can contain files. However, for a Git sandbox, the selected folder must be empty. You cannot clone a remote repository into a folder that contains files.
You need some additional setup steps if you want to merge branches with Git. See Install Command-Line Git Client.
After integrity checks are complete, you can commit the first version of your files to the new repository.