Using PlatformIO and Git

Published on Thursday, May 21, 2020

When working on my private PlatformIO project for a watertank sensor, I repeatingly struggled with how to manage the source code. PlatformIO is unfortunately not very clear explaining this topic.

Simplified, the platform.ini contains references to the utilized SDKs and library dependencies. The only PlatformIO artifact are the platform.ini and the entry in the extensions.json.

.gitignore however, will have to contain some entries to avoid commiting the cached PlatformIO is using in form of .pio.

File to add to source control

  • .vscode
    • extensions.json
  • src/* (your source code)
  • headers/* (your header)
  • platform.ini

Files in .gitignore

  • .pio (excluding all the cached libraries and board files)
  • .vscode/c_cpp_properties.json (cache over all C artifacts)
  • .vscode/launch.json (hardcoded to local directory by default)