Download software for GIT
- if you are on Linux - install git in accordance to your platform
apt-get install git,pacman -S git - on MacOS -
- I recommend git bash for Windows (https://gitforwindows.org/)
Create a repository on GitHub
Create a repostiory on GitHub, set it as a private empty repository
(optional) create SSH keys and add them to your GitHub account
Clone the repository
- Open git bash / commandline window
- Change directory to something appropriate, like:
cd /c/Users/your-user-name/PROJECTS/ArduinoWorkshop - Clone the (empty) project repository with:
- if you are using SSH key:
git clone https://github.com/pkazimierowicz/effective-guide.git - if you are using username/password:
git clone git@github.com:pkazimierowicz/effective-guide.gitReplace the repository link with an appropriate one copied from your repository.
Keep the git bash / cli window open, you will be using it.
Create a new project in PlatformIO
Open up PlatformIO, and create a new project, unselect the “Use default location”, choose a root directory of your repostiory.
So based on the example above it would end up being: /c/Users/your-user-name/PROJECTS/ArduinoWorkshop.
This should create the project as a subdirectory in that location.
Staging files - git add
If you would like to save your work at any point, you need to first add the files to git so they are tracked.
This you can do with a command git add pointing at the folder of the project.
For example: git add Excercise01
To check what you’ve just added to the repo, you can use git status, that will have an output similar to this:
Commiting changes - git commit
To actually save the work to repository, you need to commit the changes with git commit.
If you have just staged the new files, you can go ahead and type git commit -m "your commit message"
The commit message is usually a short message describing the changes done. Like:
git commit -m "added initial project files"
git commit -m "refactored SPI display code"
git commit -m "added new button actions"
But the comment convention is totally up to you!
In general - there are two ways to commit files to git.
- first manually adding them with git add (selectively adding a folder or specific files), and then
git commiting them. - just
git commit -a -m "your commit message", where-awould just commitallfiles tracked by git.
Uploading changes to GitHub
To upload commited changes to github, just go ahead and git push