Welcome to the Git/GitHub Workshop! In this session, you'll learn the fundamentals of Git and GitHub by contributing to a Mandelbrot renderer project. You will fork the repository, add custom zoom and color settings to a JSON file, and submit your changes through a pull request. By the end of this workshop, you'll have hands-on experience with essential Git/GitHub workflows.
Before you begin, ensure you have the following:
- A GitHub account
- Git installed on your computer
- MATLAB installed on your computer
- Basic understanding of Git/GitHub (helpful but not required)
By the end of this workshop, you will:
- Understand how to fork a repository on GitHub.
- Learn to clone a repository to your local machine.
- Create a new branch for your changes.
- Add custom zoom and color settings to a JSON file.
- Commit and push your changes to GitHub.
- Create a pull request to merge your changes into the main project.
- Understand how to modify and run the provided MATLAB script for rendering the Mandelbrot set.
To use MATLAB Online with GitHub, you need to create a personal access token. Follow these steps:
- Go to GitHub Personal Access Tokens.
- Click on "Generate new token".
- Give your token a descriptive name, such as "MATLAB Online Access".
- Select the following scopes:
repo(Full control of private repositories)
- Click "Generate token".
- Important: Copy the token to a secure location. You will not be able to see it again.
Not Required since using the Badge will automatically prompt for the username and token to clone the repository. However, if you want to set it up manually, follow these steps:
- Open MATLAB Online and go to the "Home" tab.
- Click on "Preferences".
- Navigate to "MATLAB > Git".
- In the "Remote" section, enter your GitHub username and paste the personal access token as the password.
- Click "Apply" and "OK".
Your MATLAB Online is now set up to interact with GitHub using your personal access token.
- Go to the Mandelbrot Renderer repository.
- Click on the "Fork" button at the top right of the page to create a copy of the repository under your GitHub account.
- Open your terminal or command prompt.
- Clone your forked repository to your local machine using the following command:
git clone https://github.com/your-username/mandelbrot-renderer.git- Navigate to the repository directory:
cd git_workshop/src/- Create a new branch for your changes:
git checkout -b add-zoom-color-settings- Open the
settings.jsonfile in your preferred text editor. - Add your custom zoom and color settings to the JSON file. Example format:
{
"settings": [
{
"xlim": [-0.748766713922161, -0.748766707771757],
"ylim": [0.123640844894862, 0.123640851045266],
"maxIterations": 500,
"gridSize": 1000,
"colorMap": "jet"
},
{
"xlim": [-0.5, 0.5],
"ylim": [-0.5, 0.5],
"maxIterations": 1000,
"gridSize": 500,
"colorMap": "hot"
}
]
}- Save the file.
- Add the modified file to the staging area:
git add settings.json- Commit your changes with a descriptive message:
git commit -m "Added custom zoom and color settings"- Push your changes to your forked repository:
git push- Go to your forked repository on GitHub.
- Click on the "Compare & pull request" button.
- Provide a title and description for your pull request, then click "Create pull request".
- Open MATLAB.
- Navigate to the directory where you cloned the repository.
- Open the
mandelbrot_render.mscript. - Modify the script to load the settings from
settings.jsonand apply them to the rendering process. - Run the script to see the Mandelbrot set with your custom settings.
Congratulations! You've successfully contributed to the Mandelbrot renderer project using Git and GitHub, and learned how to modify and run a MATLAB script for rendering the Mandelbrot set. This hands-on experience has covered essential Git/GitHub workflows and practical MATLAB usage.
- MATLAB and Simulink for Students GitHub
- Git Documentation
- GitHub Guides
- Mandelbrot Set Wikipedia
- MATLAB Mandelbrot Set Example

