Skip to content

Git Usage

A commit is a saved state of your repository. You should make a commit every time you complete a task (e.g. Add per-path auto choosers, Fix joystick inputs inversion, Tune chassis heading PID gains). This helps keep track of when new code is added. When you add changes through smaller, focused commits, you can isolate when a bug is introduced and easily roll back to a working state Writing descriptive commit messages make it easy to see exactly what changed. While diffs can only show what changed in code, commit messages can also communicate the context about a change and explain the why. By convention, commit messages are concise, begin with a capital letter, don’t use punctuation, and are in the imperative mood. Compare the following examples of good vs bad commit messages:

Good Commit MessagesBad Commit Messages
Complete a single taskInclude logic changes, formatting fixes, and refactors in one commit
Use the imperative mood: “Refactor swerve drive logic”Are past tense, lowercase, or punctuated: “refactored swerve drive logic.”
Specific and provide context: “Fix swerve drive limiter bug for reliable drive control”Are vague: “Fix bug” or “WIP”
Tip

Commit early and commit often.

For advanced users, the command line offers more functionality and is what professionals tend to use. GitHub Desktop presents a simpler way to manage commits, using checkboxes to select files to commit, a text box for commit messages, and a button to create a commit.

The main branch is where the working, tested version of the code lives during the build season. When multiple programmers are working on different changes, creating separate development branches can help prevent merge conflicts. For example, creating a seprate branch for vision code ensures that the code on the drivetrain branch isn’t affected. Making branches for each competition helps isolate fixes and ensures that code is still reviewed before merging to main.

To maintain a branch, you must stay up to date with main.

  • To merge: git fetch then git merge origin/main
  • To rebase: git fetch then git rebase origin/main

It is a good practice to push to your branch frequently to back up your work in the remote repository and make it visible to other programmers using git push.

Creating a new repository for different major projects or new seasons is a helpful way to keep track of projects. Repositories should have names that represent the purpose of its code, like “2026-rebuilt”, “2026-kitbot”, and “2026-offseason-turret”.

An in-depth tutorial can be found at the official git website.

A guide for correcting common mistakes can be found at the git flight rules repository.

GitHub Desktop is an alternative to command line or web browser interactions with GitHub. With GitHub Desktop, you can perform Git commands through a graphical user interface. It’s a good resource for teams who are new to programming and may not have a lot of Git support or experience on the team, especially rookie teams. While Github Desktop offers it’s own simplified ways of using Git and GitHub, the information mentioned in this section can still apply.

Source control in VS Code also offers a GUI for integrated source code management. It lets you run Git commands from the command palette.