Git & GitHub
Branches, pull requests, commit messages, and the 2974 team workflow.
This comes before WPILib. A programmer who can't use Git can't safely contribute to the team codebase during build season. Learn this first, use it every session.
Core Concepts
Daily Workflow
# 1. Start from current main git checkout main git pull # 2. Create your feature branch git checkout -b feature/shooter-pid # 3. Make changes, then stage and commit git add . git commit -m "feat: add velocity PID to shooter flywheel" # 4. Push and open a PR git push origin feature/shooter-pid # → go to GitHub and open a Pull Request
Never push directly to main. Always work on a branch and open a PR. Even if you're the only one working on it. This keeps the robot's working code safe from in-progress changes.
Branch Naming
| Prefix | Use for | Example |
|---|---|---|
| feature/ | New functionality | feature/auto-align |
| fix/ | Bug fix | fix/shooter-pid-oscillation |
| refactor/ | Cleanup, no behavior change | refactor/drivetrain-cleanup |
| docs/ | Comments/docs only | docs/intake-javadocs |
Commit Messages
# BAD git commit -m "stuff" git commit -m "fixed it" git commit -m "asdf" # GOOD — type: short description of what changed git commit -m "feat: add encoder-based speed control to shooter" git commit -m "fix: prevent motor from running past limit switch" git commit -m "refactor: extract PID constants to Constants.java"
Fill in the Blanks
git feature/elevator
git
git
Knowledge Check
Assignment — Your First PR
1. Clone sohnshaik/training-test-1
2. Create branch feature/yourname-intro
3. Add file intros/yourname.md with your name + one thing you want to build this season
4. Commit with a proper message
5. Push and open a Pull Request
6. Request review from Hrehaan or Sohan
When it merges, you've officially contributed to the team codebase.