🏆 Programming · Intermediate · Spartan Design Workflow

The Comp-Branch Workflow

Before each tournament, create a branch. During the event, all changes go on it. After the event, pull-request it back to main as your team's post-comp retrospective. Three phases, one rhythm, every event.

// Section 01
The Pattern at a Glance
Four phases. Each one has a single trigger and a single deliverable. Once you've done it twice, the rhythm becomes muscle memory.

This guide is the workflow Spartan Design uses for tournaments. Read the Git + VS Code Basics guide first if you haven't — that one teaches what branches and PRs are; this guide teaches when to use them.

The Four Phases

0
// Day to day
Trunk-Based on main
When there's no upcoming competition, just commit to main. Push at the end of each session. No branches, no PRs — the simplicity is the point.
1
// 1–2 days before the event
Create the Comp Branch
Branch off the latest main with a name like comp/2026-fall-league-1. Push it to GitHub. From this moment, main is frozen until the comp is over.
2
// At the event
Commit Everything to the Comp Branch
Tournament-day fixes, panic patches, last-minute auton tweaks — all of them go on the comp branch. main stays clean. If a fix turns out to be wrong, only the comp branch is affected.
3
// After the event
Pull-Request It Back
Open a PR from the comp branch to main. Review the diff with your mentor: what changes are worth keeping, what was just panic, what taught you something. Merge what stays. The PR description becomes your engineering retrospective.

Why This Works

🔒 main Is Always Safe

If your tournament-day "fix" actually broke autonomous, only the comp branch carries it. Re-cloning main on another laptop gets you back to known-good code in 30 seconds.

📝 A Built-In Retrospective

"What did we change at this event?" is a question every good team asks after a tournament. The comp branch's diff against main answers it exactly — line by line.

🎯 Selective Merging

Not every comp-day change is worth keeping. The PR review is your chance to cherry-pick what worked and revert what didn't, before any of it touches main.

📚 Permanent Record

Don't delete the branch after merging. comp/2026-fall-league-1 is forever — a cite-able record of exactly what your robot ran at that specific event.

📝
RECF EN4 reminder. The pattern documented here is process content — rewrite it in your own words for your engineering notebook, ideally with screenshots from your team's actual PRs. Judges love seeing teams that have intentionally chosen and documented their software process.
🧑‍🤝‍🧑
Multiple programmers on your team? This workflow assumes one programmer owns main. If multiple people commit to the same code, you'll want the feature-branch + pull-request model from Git & GitHub Workflow Deep Dive — the comp-branch idea still applies, but day-to-day work goes on per-feature branches instead of straight onto main.
// Section 02
Phase 1 — Before the Competition
1–2 days before the event, create the comp branch and freeze main. Five-minute job. Once it's done, you have a clean isolated workspace for whatever the tournament throws at you.
◎ 1–2 days before the comp

Naming the Branch

The format: comp/<year>-<season>-<event>. Examples:

EventBranch name
Fall League Match #1comp/2026-fall-league-1
Spring State Championshipcomp/2026-spring-state
VEX Worldscomp/2026-worlds
Off-season scrimmage at schoolcomp/2026-fall-scrimmage-1

Lowercase, hyphens between words, no spaces or special characters. Use the year so end-of-season branches sort chronologically when listed in git branch.

The Setup Commands

Run these in your project folder. (Or use VS Code's branch picker in the bottom-left status bar — click the current branch name, then "Create new branch from..." and follow the prompts.)

terminal
$ git checkout main # start from main $ git pull # make sure it's the latest $ git checkout -b comp/2026-fall-league-1 # create + switch to it $ git push -u origin comp/2026-fall-league-1 # push to GitHub, set tracking

The -u on the last command is important — it tells Git "future pushes from this branch go to the same place." Without it, you have to specify the remote every time.

What "Frozen" Means for main

From this moment until the PR is merged after the event, nobody pushes to main. No exceptions:

The reason: if anything you do during the comp is wrong, you want one clean revert path — just delete the comp branch. If even one push went to main during the event, that path is gone.

⚠️
Make sure you're actually on the branch before committing. Check the bottom-left of VS Code — it should show comp/2026-fall-league-1, not main. Half of all "I committed to the wrong branch" disasters happen because the programmer was on main and didn't notice.

Pre-Event Checklist

Before you leave for the tournament

  • main is in a known-working state — auton runs, opcontrol works, robot drives.
  • Comp branch created from latest main and pushed to GitHub.
  • You've verified the comp branch builds and uploads to the robot successfully.
  • You're currently checked out on the comp branch, not main.
  • Your laptop's battery is charged and you have a USB-C cable for the brain.
  • Mentor knows the comp branch name and can pull it on their laptop if needed.
// Section 03
Phase 2 — At the Competition
Tournament day. The robot misbehaves between matches. You make changes. The discipline now is to make those changes on the comp branch, with messages that explain what's happening.
◎ Throughout the event

Every Fix Is a Commit

Even tiny changes between matches get committed to the comp branch with a real message. The reason isn't ceremony — it's that the commit history is your event log:

good comp-day commit messages
Increase chassis kP from 18 to 22 - was undershooting on tile gap Reduce auton drive distance by 4in - field was set up shorter than practice Add 200ms delay before claw close - intake jam at high speed Remove sentry mode from auton - vision sensor too unreliable on this field Revert kP increase - was overshooting now, going back to 18

Look at that history six weeks later and you have a tournament timeline. Match 4: kP increased. Match 5: auton distance reduced. Match 7: kP reverted. "Did the kP change actually help?" — the commit history will answer.

Pushing Between Matches

If you have wifi at the event, push to GitHub between matches. Push the comp branch only. Never push to main during a comp:

terminal — or just hit the ↑ cloud icon in VS Code's status bar
$ git add . $ git commit -m "Increase chassis kP from 18 to 22" $ git push # goes to comp branch since you're tracked there

If wifi is bad — common at competitions — commit locally and push when you get back. The commits aren't lost, they just haven't been mirrored to GitHub yet.

The "Did I Break It?" Recovery

You made a change between matches and now nothing works. Three responses, ranked by how reversible they are:

  1. Revert the last commit. git reset --hard HEAD~1 — throws away the most recent commit and resets your working files. Use when you know exactly which commit broke things.
  2. Stash and reset. Save your changes for later, return to a known-good state. git stash saves them, git reset --hard HEAD goes back to the latest committed state. git stash pop brings them back later.
  3. Nuclear option. Delete the cloned folder, re-clone from GitHub, check out the comp branch. Slow but guaranteed clean state. Useful if you've made a mess of your local working copy.
🔥
git reset --hard is destructive. Files in your working directory are wiped. Make sure you've actually committed everything you want to keep before running it. If unsure, git stash first — that's the non-destructive way to "set aside" changes.

Mid-Event Branching: When NOT to Do It

Don't create sub-branches off the comp branch during a tournament. Resist the urge to do comp/2026-fall-league-1/auton-experiment. The whole point of the comp-branch pattern is one branch per event — multiple branches multiplies confusion at the worst possible time.

If an experiment fails, just commit "experiment" then commit "revert experiment" right after. The history shows what you tried and what you went back to. That's a feature, not a bug.

// Section 04
Phase 3 — The PR Back to main
You're home. Your competition's over. Now the comp-branch's diff against main is the most useful artifact your team has. Open the PR, review honestly, merge what was real progress.
◎ Within a week of the event

Opening the PR

  1. Push the final state of the comp branch (if you haven't already): git push.
  2. Open the repo on github.com. There's usually a yellow banner: "comp/2026-fall-league-1 had recent pushes — Compare & pull request." Click it.
  3. If no banner, go to the Pull requests tab and click New pull request. Set base to main, compare to your comp branch.
  4. Write a real PR description — this is the part that becomes your engineering record.
  5. Click Create pull request.

The PR Description Template

Don't accept GitHub's auto-generated description. Replace it with something like:

PR description — the post-comp retrospective
## Fall League #1 — 2026-09-14 **Result:** 4-2 in qualifications, eliminated round of 16. ### What we changed during the event - Chassis kP 18 -> 22 (better turns, kept it) - Auton drive distance reduced 4in (field setup, kept it) - Sentry mode disabled (vision flaky, will investigate) - Claw delay before close (intake jam fix, kept it) ### What worked - The kP increase noticeably improved drive accuracy. - Reducing auton drive distance prevented the over-the-line penalty. ### What we're throwing away - Disabling sentry was the right call at the event but the underlying issue is fixable. Will revisit before next comp. ### What we learned - Field setups vary by venue more than expected — need to parameterize auton drive distances rather than hard-code. ### Reviewers @arturo-andrade please verify before merge.

Reviewing the Diff Together

Sit with your mentor (or have a video call). Open the PR's Files changed tab. Walk through every change line by line:

Merging the PR

If the diff looks good as-is, click Merge pull request. Pick Create a merge commit rather than squash — you want every individual comp-day commit preserved in main's history.

If you want to keep some changes and revert others, do that on the comp branch before merging:

terminal — revert specific commits before the merge
$ git checkout comp/2026-fall-league-1 $ git log --oneline # find the commit to undo $ git revert <sha> # creates a new "undo" commit $ git push # PR updates automatically

Then merge the PR. The merged result is "everything from the comp branch except the parts we reverted."

After the Merge

Don't delete the branch. GitHub asks if you want to delete the merged branch — click No. Keep the comp branch around forever. It's the historical record of what your robot ran at that specific event, and you may want to point a judge or a future teammate at it.

💬
Optionally tag the merge. Right after merging, run git tag -a 2026-fall-league-1 -m "Fall League #1 merged" from main, then git push --tags. This makes the merge commit easy to find later via the GitHub Releases page. Lightweight version of "what code did we run at each event."
// Section 05
PR Review Checklist (For Mentors)
A short checklist mentors can use when reviewing comp-back PRs. The point is to surface judgment calls — not to gatekeep, but to make sure the team-day decisions get a calm second look before they become permanent.

This page is intended to be linked directly when assigning a mentor reviewer. Mentors can copy the checklist into the PR comments and tick boxes as they go.

The Code Review Checklist

Style and convention

  • Magic numbers replaced with named constants? (SCORE_STOP_MM = 280 not just 280)
  • Comments explain why a value is what it is, especially anything tuned at the event?
  • No leftover debug prints (master.print calls left over from troubleshooting)?
  • No leftover commented-out code from experiments? (Either delete it or keep it with a comment explaining why.)

Safety

  • Any new infinite loops have a timeout or break condition?
  • Sensor reads have a noise filter or sanity check (e.g. distance > 0 && distance <= target not just distance <= target)?
  • Hard limits respected on mechanisms that have hard stops (pot range, bump switches)?
  • If autonomous routines were tweaked, the safety caps (max travel distance, max time) are still in place?

Engineering retrospective

  • The PR description names what worked and what didn't?
  • If a hack was kept (e.g. "disable sentry mode"), there's an issue or note about fixing the underlying cause?
  • If a tuning value changed, is the new value the right answer for ALL fields or just the one at this event? Should it become a parameter?
  • Anything from this event that should make it into the engineering notebook?

The "Don't Merge Yet" Conversation

Sometimes a PR isn't ready. Common reasons to pause:

None of these are reasons to be harsh. The student made decisions under pressure at a tournament — the PR review is the calm follow-up, not a critique. The framing that works: "Now that we have time, here's what I'm noticing — want to fix any of these before merge?"

⚙ STEM Highlight Software Engineering: The Code Review as Pedagogy
In the software industry, code review is one of the most reliable ways junior engineers learn from senior ones — not because the senior reviewer "catches mistakes" but because articulating a critique forces the reviewer to explain reasoning that's normally implicit. The student-mentor PR review is the same dynamic compressed into a tournament cycle. The comp-day decisions get re-examined when no clock is running, and the mentor's reasoning becomes visible to the student through the line-by-line comments. It's the closest thing to professional engineering mentorship a high-school program can offer, and the comp-branch workflow is what makes it possible.
🎤 Interview line: “After every tournament we do a code review on the comp branch before merging it back to main. The PR is the artifact — reviewer and student walk through it line by line, deciding what's worth keeping. It's modeled directly on the code-review process at professional software companies, and it's where most of our actual engineering learning happens.”
// Section 06
Edge Cases
The four "what do I do if..." situations that come up most. Each has a calm answer if you know where to look.

"I Forgot to Create the Comp Branch"

You're at the event, you make a fix, and you realize you've been committing to main the whole time. Don't panic. The recovery is two commands:

terminal — rescue main, retroactively branch
$ git checkout -b comp/2026-fall-league-1 # branch HERE, taking the recent commits with you $ git push -u origin comp/2026-fall-league-1

This puts your event-day commits on the comp branch where they belong. main on your laptop is now ahead of main on GitHub by those same commits — which is fine, because you're not going to push it.

If you've already pushed to main on GitHub, that's a bigger problem — the wrong commits are now on everyone's main. Ask your mentor for help; the fix is a force-push to revert main to where it was before, but force-pushing affects everyone with a clone, so it has to be coordinated.

"Someone Pushed to main While I Was at the Comp"

The comp-branch policy says "main is frozen during a comp" but life happens. A teammate or mentor pushed something to main while you were at the event. Now your comp branch is "behind" main by their changes.

The fix when you PR: GitHub will warn that the branch can't be auto-merged. Pull main into the comp branch, resolve any conflicts, push, then merge:

terminal — bringing main's changes into the comp branch
$ git checkout comp/2026-fall-league-1 $ git pull origin main # merge main's changes in # resolve any conflicts in VS Code $ git push

"The Comp Branch Has 30 Commits and the PR Is Overwhelming"

Long tournaments produce long histories. If the PR description has 30 bullet points, group them by category in the description:

PR description — grouped for a long event
## Auton tweaks (commits abc1234..def5678) - 4 commits adjusting drive distances - Net result: corrected for the venue's tile gap ## Chassis tuning (commits ef98765..bb11223) - kP swept from 18 to 22 to 20 over 5 commits - Final: 20 (best of the three) ## Sentry experiments (commits cc44556..dd77889) - Multiple attempts to fix vision flakiness - All reverted; sentry stayed disabled - Want to address as a separate PR after we get a new lighting test

That makes the review tractable. The mentor can focus attention on the chassis tuning section if that's the most important, skim the others.

"I'm at the Event and Need a Fresh Clone"

Your laptop dies. You grab a borrowed laptop. You need the latest comp-branch code on it in five minutes. The recovery:

terminal — emergency clone of the comp branch
$ git clone -b comp/2026-fall-league-1 --single-branch \ https://github.com/spartandesign/2822-fall-2026.git $ cd 2822-fall-2026 $ code .

The -b flag puts you straight on the comp branch. --single-branch avoids downloading main and any other branches you don't need at the event — faster on slow tournament wifi.

You'll need to sign in to GitHub on the borrowed laptop (Section 3 of GitHub Getting Started). If the laptop doesn't have Git installed at all, install via the PROS USB drive your mentor brought (or worst case, fall back to the brain's own program memory and don't touch Git until you get home).

⚠️
If you can't get on GitHub at the event, at minimum copy the working source files off the dying laptop to a USB drive before it stops booting. Source files plus your .git folder is a complete backup. Worst case, you can restore the project from those when you get home.

You're Set

Three guides done. You have the local-Git basics, you're on GitHub with the team, and you know the comp-branch workflow. The next time you're at a tournament, you'll have a clean event log, a safe fallback, and a built-in retrospective when you get home.

📝
Final EN4 reminder. The patterns in these three guides are processes Spartan Design has chosen to follow. Document your team's adaptation of them in your engineering notebook — with screenshots from your team's actual repo, your team's actual PRs, and your team's own decisions about what worked. That's exactly what the EN4 rubric is asking for.
Related Guides
💻 Git + VS Code Basics → 🔗 GitHub Getting Started → 📂 Version Control Basics → 📝 Notebook Pathway →
← ALL GUIDES