Skip to content
Work in progress. This library and its docs are new and still changing, and some parts are not yet tested on a real robot. If something is wrong or unclear,tell us with a short GitHub form.

Set up 8: every practice: pull, change, commit, push

Everyone who changes code does this, every practice.

Why: git keeps every saved version of the code. You can undo a mistake, share code between laptops, and get back the exact code that ran at the last event.

1. Pull first: get the team’s newest code

Section titled “1. Pull first: get the team’s newest code”

GitHub Desktop: click Fetch origin (top bar). If it changes to Pull origin, click it.

Command line:

Where: Android Studio’s Terminal tab, in the project folder (a new Terminal tab starts there). (Which folder)

Terminal window
git pull
git submodule update

Why git submodule update: it puts the library at the version the project expects.

Make one change at a time. Build (hammer), install (Run), and test on the robot.

3. Commit: save a snapshot each time a small change works

Section titled “3. Commit: save a snapshot each time a small change works”

GitHub Desktop:

  1. The Changes tab lists the changed files. Untick a file you do not want.
  2. Type a message in Summary (bottom left).
  3. Click Commit to main.

Command line:

Where: the same Terminal tab, in the project folder.

Terminal window
git status
git add TeamCode
git commit -m "Auto: park 2 in further left"

Read what git status lists, so you commit only what you meant to.

A good message says what changed and why: Lift: high step 2400 -> 2350 (it hit the stop). Not stuff or fix.

GitHub Desktop: click Push origin.

Command line:

Where: the same Terminal tab, in the project folder.

git push

When the push is refused (rejected ... fetch first), a teammate pushed first. Pull (step 1), then push again.

  1. main always builds and works. Never push code that does not build.
  2. Pull before you start.
  3. Commit often, one small working change at a time.
  4. Push before you leave. Until then, your commits are only on your laptop.
  5. Two people, one file: talk first (“I am changing Tunables.java”).

You pulled at the start, and you pushed your work at the end.

More git (branches, conflicts, undo, before an event): Git and GitHub for FTC teams.

Set up is done. Next: Pick your start: the code you start from.

Look it up: Troubleshooting: git problems.

Something wrong on this page? Tell us with a short GitHub form.