Skip to content

Using Git

Will Richards edited this page Sep 3, 2023 · 1 revision
Author: Will Richards

Being able to use Git effectively and properly makes development faster by reducing the likelihood of bugs getting through to our production code.

To accomplish this branch protections have been put in place for the main branch and as such doesn't allow direct pushes, code can still be modified through pull requests into main. These require 1 reviewer to approve the push to main.

Most of your version control of Loom code will likely be done through Visual Studio Code's version control UI. Note: If by this point you haven't installed both Visual Studio Code and Git you should do this now

Basic Git

Now that we have Git installed when we open VSCode and navigate to our Loom instance

%localappdata%\Local\Arduino15\packages\loom4\hardware\samd\VERSION\libraries\Loom

Pulling

We now have an option at the bottom that displays our current branch as well as a circular arrows. Pasted image 20230902171843

These also change to numbers showing the number of both unpulled changes and unpushed commits.

Making and Staging Commits

Moving to the Source Control tab

Pasted image 20230902172013

From here you can generate commits to push into the selected branch. When you first start using this it will not auto stage changes but if you press commit without staging any it will ask if you want to auto stage. If you want you can also manually stage your changes like so..

Pasted image 20230902172333

From here provide a solid commit message..

Pasted image 20230902172423

And commit the changes!

Pushing

All that's left to do is push the commits by pressing Sync Changes

Pasted image 20230902172522

You have successfully made and pushed your first commit

Creating new branches

To actually modify and push code to create pull request you will need to make a new temporary branch to address the changes. To get started simply click on the current branch in the bottom left corner. It is recommended that bug fixes be branched from main and more major development work be made from dev

Pasted image 20230902172810

Next give the branch a name and then when you want to publish the branch to create pull request off you click here

Pasted image 20230902173024

That branch is now published to the repository and changes can be committed to as shown above

Creating Pull Requests

At some point you will likely want to pull that change into main after through testing has been done. At this point you can create a pull request for your branch.

Pasted image 20230902173439

After clicking New Pull Request you can select the branch that you would like to pull from and address any merge conflicts and then you can Create the pull request

Pasted image 20230902173700

After giving it a title and any additional information that may be needed to approve it and you can create the pull request

Pasted image 20230902173843

Now you have committed your changes to a new branch and pulled your new changes into main!