# Using Git for Arduino Project Documentation

This guide will help you get started with the basics of Git version control and documentation for your Arduino projects. Follow these simple steps to learn Git and begin documenting your own project.

# Step 1: Install Required Software

  1. Install Git

    • Download from git-scm.com and follow the installation instructions for your operating system
    • For macOS, you can also use brew install git if you have Homebrew
  2. Install VS Code

    • Download Visual Studio Code from code.visualstudio.com
    • This will be your text editor for code and documentation. Note that there are plugins that allow for Arduino development within VS Code. Skipping that in favour of the basics here.
  3. Install the Arduino IDE

# Step 2: Clone The Starting Repository

You can explore the starter github repository here.

  1. Open your terminal or command prompt

  2. Navigate to where you want to store the repository

  3. Run this command to clone the repository:

    git clone https://github.com/jtrudeau/arduinogitresource2025.git
    
  4. Move into the cloned directory:

    cd arduinogitresource2025
    

# Step 3: Explore the Repository

  1. Open the repository in VS Code. From the terminal you can type:

    code .
    
  2. Important Resources to Explore:

    • README.md: Overview of the repository
    • EXERCISES.md: Optional practice exercises to learn Git
    • templates/: Contains project templates and examples
    • templates/MARKDOWN_GUIDE.md: Guide to formatting your documentation
    • templates/ARDUINO_PROJECT_TEMPLATE.md: Template for Arduino project documentation
    • templates/sample_project/: Rough example Arduino data logger project
    • examples/: Sample files to reference
  3. Complete a few exercises from EXERCISES.md to get familiar with Git commands

# Step 4: Start Your Own Project Repository

Once you're familiar with the basics, create your own repository for your Arduino project:

  1. Go to github.com and sign in.
  2. Click the "+" icon in the top right and select "New repository"
  3. Name your repository (e.g., "arduino-datalogger-project")
  4. Choose "Public" visibility
  5. Do NOT initialize with README, .gitignore, or license
  6. Click "Create repository"
  7. GitHub will show instructions for pushing an existing repository - you'll use these soon

# Step 5: Initialize Your Project

  1. Create a new folder for your project:

    mkdir my-arduino-project
    cd my-arduino-project
    
  2. Initialize Git in this folder:

    git init
    
  3. Open the project in VS Code:

    code .
    
  4. Start by creating a README.md file (use our template as a guide):

    • Copy the content from templates/ARDUINO_PROJECT_TEMPLATE.md
    • Save it as README.md in your new project
  5. Create your first commit:

    git add README.md
    git commit -m "Initial commit with README template"
    
  6. Connect your local repository to GitHub:

    git remote add origin https://github.com/YOUR-USERNAME/arduino-datalogger-project.git
    

    (Replace YOUR-USERNAME with your GitHub username, and arduino-datalogger-project with your repository name)

  7. Push your first commit to GitHub:

    git push -u origin main
    

# Step 6: Document Your Arduino Project

  1. Create a project structure:

    • images/: Folder for images and diagrams
  2. Document your project using the templates:

    • Update your README.md with your project information
    • Add Arduino code
    • Use markdown formatting from the Markdown Guide
    • Take photos or create diagrams of your circuit and add them to the images/ folder
  3. Commit your changes regularly:

    git add .
    git commit -m "Add project documentation and code"
    git push
    

# Getting Help

If you get stuck:

  • Ask for help
  • Refer to the Git Cheat Sheet in this repository
  • Check the GitHub documentation
  • Look at the sample project for examples of good documentation

Remember: The goal is to document your Arduino project clearly so that others can understand and replicate your work.