💻 Programming · Beginner · Engineer

Git + VS Code Basics for VRC

Watch the 7-minute Microsoft video, then layer on the PROS-specific bits the video doesn't cover — the right .gitignore, what to commit, and the branch-naming convention that survives a season.

// Section 01
Why Bother With Git for VRC
Every VRC team eventually loses code. Flash drive corrupted. Laptop reformatted. main_v2_FINAL_REAL_use_this_one.cpp. Git is the engineering practice that prevents all of those.

The Three Disasters Git Prevents

The Lost Flash Drive

Two weeks before competition, the flash drive carrying the team's autonomous routine disappears between the bus and the engineering room. With Git, the code lives on GitHub. Without it, you're rewriting from memory.

The Overwrite

Two coders edit the same file on different laptops. Whoever uploads second silently destroys the other one's work. With Git, conflicts are surfaced and resolved before a merge. Without it, you only find out at the next match.

The "FINAL_v2" Spiral

Every change ships as a new file: main.cpp, main_v2.cpp, main_FINAL.cpp, main_FINAL_USE_THIS.cpp. Nobody knows which one is current. With Git, every version of one file is preserved with a message explaining what changed.

The Mystery Regression

"Auton worked on Tuesday. Doesn't work today." Without Git, you have no idea what changed. With Git, you can git log through every commit since Tuesday and find the one that broke it.

Git, GitHub, and VS Code — Three Different Things

The names get used interchangeably even though they're separate tools that work together. Worth getting the distinction straight from day one:

NameWhat it isWhere it runs
gitThe version-control program. Tracks every change in your project's history.On your laptop
GitHubA website that hosts your Git repositories so the team can share them.github.com (cloud)
VS CodeThe editor you write code in. Has a built-in panel that drives Git for you.On your laptop

The video in the next section shows VS Code running Git locally and pushing to GitHub. All three tools, working together. That's the full picture.

Why VS Code Specifically

Your PROS extension already lives inside VS Code. The same window you write robot code in also has a built-in Source Control panel that runs Git for you — no separate terminal commands needed for the basics. One tool, both jobs.

📝
RECF EN4 reminder. Code and configuration on this page is reference material. The .gitignore in section 4 is one EZ-Template ships with their starter project — that's not yours to "rewrite," it's part of the library. Anything you DO write (commit messages, branch policies in your notebook) should be in your own words.
🧑‍🤝‍🧑
Multiple programmers on your team? This guide teaches the trunk-based + comp-branch flow that works best when one person owns the codebase per robot. If your team has multiple coders contributing to the same code, the feature-branch + pull-request model in Git & GitHub Workflow Deep Dive may serve you better. Both flows are first-class — pick the one that fits your team.
// Section 02
Watch This First — 7 Minutes
Microsoft's official Git + VS Code tutorial. Initialize, stage, commit, branch, merge, push to GitHub, clone — the whole loop in seven minutes. Watch it once. The rest of this guide layers VRC specifics on top.

Timestamp Index

Use these to jump to a specific topic when you re-watch later.

🎥
If the video won't play in school — some district networks block YouTube. Watch it at home or on your phone. The same workflow shows up in every VS Code Git tutorial; if you can't watch this specific one, search "VS Code git tutorial beginner" and pick any 5–10 minute video that covers the same outline.

What the Video Doesn't Cover

The video uses a generic Node project, not a robotics project. The next sections fill in:

// Section 03
Install Git Locally (One Time)
VS Code's Source Control panel runs the git program in the background. The program has to be installed on your laptop first. Five-minute setup, done once per machine.
◎ One-time setup

Install

  1. Go to git-scm.com/downloads and download the installer for your OS.
  2. Run the installer. Accept all the defaults — the installer asks 15+ questions but the defaults work for everyone. Don't overthink them.
  3. Restart VS Code if it was open. VS Code only sees Git after a restart.

Tell Git Who You Are

Every commit gets stamped with a name and email so the team can see who changed what. You set those once, globally, and Git uses them forever after. Open a terminal in VS Code (Terminal → New Terminal) and run:

terminal
$ git config --global user.name "Your Name" $ git config --global user.email "you@example.com"
⚠️
Use the email you'll use on GitHub. If your commit email and your GitHub email don't match, GitHub won't link your commits to your profile and your contribution graph stays empty. Pick the email you'll register with and use it everywhere.

Verify It Worked

Run this and confirm it prints a version number:

terminal
$ git --version git version 2.45.0 # exact number doesn't matter, any 2.x is fine

If you get command not found, the installer didn't add Git to your PATH — restart your terminal, then your laptop. If still broken, reinstall.

💡
VS Code's Git extension comes preinstalled. You don't need to install anything in VS Code itself — the moment git is on your PATH, VS Code's Source Control panel (the third icon in the left sidebar, looks like a branching diagram) lights up and works.
// Section 04
Your First PROS Repo — What to Commit
A PROS project generates files you keep and files you don't. Commit the wrong ones and your repo bloats with megabytes of binaries that change every build. The .gitignore file controls this.

What's in a PROS Project

If you've made an EZ-Template project, you have a folder that looks like this:

your-project/
.gitignore // tells git which files NOT to track .clang-format // code style Makefile // build instructions common.mk // shared make config project.pros // PROS metadata EZ-Template@3.2.2.zip // vendored library bundle (big!) compile_commands.json // IDE intellisense (regenerated each build) firmware/ // vendored .a library binaries (KEEP) include/ // your headers (KEEP) src/ // your code (KEEP) bin/ // compiled output (regenerated each build)

The Two Buckets

✅ Commit These

Anything you wrote OR vendored libraries that the build needs:
src/, include/, firmware/, Makefile, common.mk, project.pros, .clang-format, .gitignore

❌ Don't Commit

Anything that gets regenerated by a build, plus IDE-local config and OS metadata:
bin/, *.o, *.elf, *.bin, compile_commands.json, .cache/, .vscode/, .DS_Store, *.zip

The PROS .gitignore

EZ-Template's starter project ships with a working .gitignore. If you're starting from a fresh PROS project that doesn't have one, this is the minimum that handles the common cases:

.gitignore (ships with EZ-Template)
# Compiled object files *.o *.obj # Executables *.bin *.elf # PROS bin/ .vscode/ .cache/ compile_commands.json temp.log temp.errors *.ini .d/

Worth Adding

Two extra rules teams typically add on top:

extra rules
# Vendored library bundles — firmware/ has the .a files we actually need; # the source zip is just for re-installing into a fresh project. *.zip # macOS finder metadata — appears constantly on Mac dev laptops. .DS_Store # Windows folder thumbnails. Thumbs.db
💭
Why .vscode/ is in there. .vscode/settings.json often contains absolute paths from one specific laptop — checking it in can break VS Code on a teammate's machine. Keep it ignored unless your team agrees on a specific shared config worth committing.

Your First Commit

Once .gitignore is in place, you're ready to take a snapshot. Open the project in VS Code, then:

  1. Open the Source Control panel (third icon in the left sidebar).
  2. Click Initialize Repository. The whole folder becomes a Git repo.
  3. VS Code shows every file as "Changes." Hover one, click + to stage it. Or click + next to Changes to stage everything at once.
  4. Type a commit message in the box at the top. Write a real sentence — "Initial commit of EZ-Template clawbot project" beats "stuff" every time.
  5. Click Commit (the checkmark icon).

That's a snapshot. You can do this every time you finish a feature, fix a bug, or just want to mark a known-working state. Commit early, commit often.

📝
What makes a good commit message? Present-tense imperative, focused on what the change does, not how. Good: "Add stall detection to intake", "Fix arm preset overshoot when battery low", "Increase chassis kP from 18 to 20". Avoid: "stuff", "asdf", "test", "Update file.cpp". The mentor reading the commit history six months from now is your future-self.
// Section 05
Branching the Spartan Design Way
Most VRC teams have one programmer per robot. Feature branches add overhead with no benefit when there's only one of you. The pattern Spartan Design uses: trunk-based development, plus one branch per competition.

The Day-to-Day: Just Stay on main

For a solo programmer, working directly on main is the simplest workflow that exists. Commit when something works. Push to GitHub at the end of each session. That's it — no branches to remember, no merges to perform, no PRs to open.

This is called trunk-based development. It's what Google, Meta, and most of the software industry use. The reason it works: every commit to main is small enough to be safe, and the history of main tells the story of the project as it actually evolved.

💡
Two coders sharing a robot? Use feature branches like the older guidance below. The trunk-based pattern only works when one person owns main. Once two coders are pushing, you need branches and PRs to avoid silent overwrites.

The One Exception: A Branch Per Competition

Two days before a tournament, create a branch named after the event. From that point until the comp is over, all changes go on the comp branch. main is frozen.

terminal — or use VS Code's branch picker (bottom-left status bar)
$ git checkout main $ git pull # start from the latest main $ git checkout -b comp/2025-spring-state # branch off main $ git push -u origin comp/2025-spring-state

What This Pattern Buys You

Without comp branchesWith comp branches
A 3am tournament-day patch goes straight to main — if it breaks, you've broken the working version.The comp branch absorbs all event-day changes. main stays at its known-working state until you decide what to keep.
After the competition, you have no clean way to see "what changed during the event."git diff main..comp/2025-spring-state shows you every change made during the tournament — useful for the engineering notebook.
Bad fixes pile onto main permanently.You review the comp branch after the event and only merge the changes that actually worked.

After the Competition: PR It Back

Once you're home from the event:

  1. Push the final state of the comp branch.
  2. Open a Pull Request from comp/2025-spring-statemain on GitHub.
  3. Review your own diff. Did the PID changes actually help? Was the auton hack a real fix or a panic patch? Decide what stays.
  4. Have your mentor or another coder review the PR.
  5. Merge what's worth keeping. Discard what wasn't (you can revert specific commits in the PR before merging).

The PR review is the engineering retrospective for the competition. Three months later when you're studying for your interview, the PR description plus the merge commit are the record of what your team learned at that event.

⚠️
Don't delete the comp branch after merging. Keep it forever — it's the historical record of what the robot actually ran at that specific tournament. If a judge ever asks "what was the code at the State competition?", you can point to the branch.

Branch Naming — Pick a Convention, Stick to It

The convention used here:

PatternExampleWhen
main(just one)The trunk. Day-to-day work happens here.
comp/<event-slug>comp/2026-fall-league-1One per tournament. Created 1–2 days before, PR'd back after.
season/<year>season/2025-high-stakesEnd-of-season snapshot. Created once when a season ends, never modified after.

Use lowercase with hyphens. No spaces, no underscores. The names show up in the GitHub UI and in git log output — readable matters.

⚙ STEM Highlight Software Engineering: Why Trunk-Based Wins for Solo Developers
There's a long-running debate in the industry between trunk-based development (everyone commits to main, used by Google and most modern startups) and git-flow (heavyweight branching with release/hotfix/develop branches, used by older enterprise teams). The trade-off is between iteration speed (favoring trunk-based) and parallel-development isolation (favoring branches). For solo programmers, there's no parallel development to isolate — the only "other person" who'd ever cause a merge conflict is past-you, and past-you is in git log. Trunk-based wins. The single exception — a frozen branch for production-critical moments — is exactly what the comp-branch pattern formalizes.
🎤 Interview line: “We use trunk-based development with one frozen branch per competition. The trade-off here is iteration speed versus tournament-day reliability. With one programmer per robot there's no concurrent-development conflict to isolate, so feature branches add overhead with no benefit during normal work. The comp branch only appears when we need event-day code isolation. After each tournament we pull-request the comp branch back to main — that PR review becomes our post-event engineering retrospective.”
// Section 06
When Things Break — Survival Guide
Every Git user gets stuck. Most of the panic moments have a calm answer if you know where to look. Here are the four most common ones and what to do without making it worse.

"I Committed Something I Shouldn't Have"

You committed an API key, a binary file, or a half-broken change you weren't ready to share. If you haven't pushed yet, this is easy.

terminal — undo the LAST commit, keep your changes
$ git reset --soft HEAD~1 # undo commit, files stay changed # Now fix the staging, then re-commit.
⚠️
If you've already pushed, stop typing and ask your mentor or another team member who knows Git. Force-pushing to a shared branch is dangerous — it deletes other people's commits. The fix exists, but it has to be done with everyone's awareness.

"I Got a Merge Conflict"

Two coders edited the same lines and Git can't decide which version wins. VS Code shows the conflicting file with both versions side by side and a Resolve in Merge Editor button. Click it. The editor shows:

Pick the lines that should win, save, then commit the merge. Resolving a conflict is a normal part of Git, not a sign that something is broken.

"I Pushed to the Wrong Branch"

You meant to push to dev/feature but you pushed to main. If main still works, leave it alone — the commits are fine, they're just in the wrong branch. If main is broken because of the push, immediately revert:

terminal — safely undo the latest commit on a shared branch
$ git revert HEAD # creates a new commit that UNDOES the last one $ git push

git revert is safe to push because it adds a new commit instead of rewriting history. Use it whenever you need to undo something on a branch other people are also using.

"I'm Stuck in a Weird Editor"

Sometimes Git opens vim for a commit message and you can't figure out how to type or exit. The keystrokes are:

  1. Press i to enter insert mode (now you can type).
  2. Type your message.
  3. Press Esc to leave insert mode.
  4. Type :wq and hit Enter to save and quit.

To make this never happen again, set VS Code as your default Git editor:

terminal — one-time fix
$ git config --global core.editor "code --wait"

The Universal Escape Hatch

If you're stuck, panicking, and don't know what's going on — stop typing. Don't run any commands you don't understand. Take a screenshot of the terminal, post it to the team Discord, and ask. The single worst thing you can do is keep trying random fixes and make the situation harder to recover from.

🔥
Never run git push --force on a shared branch unless a mentor tells you to. Force-push deletes everyone else's commits on that branch. There are situations where it's the right move, but they're rare and require knowing exactly what you're erasing.
// Section 07
What's Next
You can now make and commit changes locally. The next guides cover the team-collaboration parts — pushing to GitHub, pulling teammates' work, opening pull requests, and keeping competition code safe.

The Sequence

🎯 You Are Here

Git + VS Code Basics — Local Git, the PROS .gitignore, the trunk-based pattern. Done.

⏭ Up Next

GitHub Getting Started — accept your invite to the spartandesign org, sign in via VS Code, clone your team's repo, push your first commit.

🏆 Tournament Workflow

The Comp-Branch Workflow — before the event, during the event, after the event. The PR-back-to-main pattern, end to end.

📚 Reference

Version Control Basics — the conceptual companion to this guide. The why behind the how.

Practice in the Meantime

Don't wait for the next guide to start using what you learned. Three small exercises before the GitHub-onboarding guide:

  1. Take your current PROS project. Make sure it has a .gitignore. Initialize a Git repo. Make your first commit with a real sentence as the message.
  2. Make a small code change. Commit it with a descriptive message. Use VS Code's Source Control panel for the whole thing — no terminal needed.
  3. Run git log in the terminal. Confirm both your commits show up with your real name and your real commit messages.

If the log shows your commits with messages that actually describe what changed, you've got the local Git basics. The next guide takes that and pushes it up to github.com/spartandesign.

🔬 Check for Understanding
It's the morning of a competition. You're on the comp/2026-fall-league-1 branch. You make a quick auton fix, but it doesn't quite work. Your match is in 10 minutes. What's the safe move?
Push the broken fix to main directly so it's in the "real" branch.
Commit it to comp/2026-fall-league-1 anyway. The whole point of the comp branch is that experimental and panic fixes are isolated from main. After the event, the PR review decides what stays.
Don't commit anything — just upload the broken fix to the brain and try not to forget it.
git push --force over main with the comp branch.
📝
Notebook this section. The branching pattern (Section 5) and the survival-guide responses (Section 6) are processes your team has chosen to follow. Document them in your engineering notebook in your own words, ideally with a screenshot of your team's branch list. Judges love seeing teams that have thought intentionally about their software process — that's what EN4 is asking you to do.
Related Guides
📂 Version Control Basics → 🔧 Setup Guide → 📄 Organizing Code → 🪾 Clawbot Training →
← ALL GUIDES