Version Source Control#
Git is a distributed version control system that tracks versions of files. It is often used to control source code by programmers collaboratively developing software. A version control system is essential for modern coding development. 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 Current Folder browser, 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.

Fig. 2 The basic workflow for working with the remote repository.#
Join Github#
To get started with GitHub, you’ll need to create a free personal account and verify your email address.
My First Repository#
We will begin by creating a repository where you can store and manage your code projects. A repository serves as a dedicated space in which all your files, along with their version history, are kept. By following these steps, you will have created your first GitHub repository, establishing a foundation for version-controlled development and future collaboration.
Access Your GitHub Profile: After signing in, click on your profile icon in the upper-right corner of the GitHub homepage, then select Your repositories.
Create a New Repository: On the repositories page, click the New button. This action will open a form for creating a new repository.
Name Your Repository: Choose a clear and descriptive name, such as
my-first-repo
. Keep in mind that this name will be part of the repository’s URL.Description (Optional): You can add a short description to help others understand the purpose of your repository.
Set the Repository’s Visibility:
Public: Anyone can view and clone the repository. If you want to share your work more easily, you should set it to public.
Private: Only you and collaborators you specify can access the repository.
Initialize this repository with a README (Recommended): By selecting Add a README file, you create a default file that you can edit to introduce your project and provide relevant instructions or documentation.
Add a License (Optional): If you plan to make your repository open source, consider adding a license.
Create the Repository: Click Create repository. You will be taken to the main page of your newly created repository, where you can add files and explore other GitHub features.
Set Up Git Source Control with MATLAB#
The Git cheat sheet shows the command line operations such as Add, Commit, Push, Pull and Fetch.
Tip
To enable source control integration in MATLAB, you might need to go to Preferences tab, navigate to General, then select Source Control, and activate the MathWorks source control integration.