Git commands
Git is how the team shares code without overwriting each other. You only need these five moves. Run them in the VS Code terminal, one line at a time.
- 1
Once, on a new laptop
Tells Git whose name goes on the commits. Do this before anything else.
Terminal git config --global user.name "Your Name"git config --global user.email "you@example.com" - 2
Get the team's code
Clone downloads the repository into a folder. You do this once per repo.
Terminal git clone https://github.com/YOUR-TEAM/training-repo.gitcd training-repo - 3
Start this week's work
Start from the week's starter branch, then make your own branch so your work never lands on someone else's.
Terminal git checkout week3-startergit checkout -b yourname-week3 - 4
Save and share it
Add stages your changes, commit saves them with a message, push sends them to GitHub. Then open a pull request on GitHub.
Terminal git add .git commit -m "Add Intake class with run, reverse, and stop"git push -u origin yourname-week3 - 5
Get back to the main branch
Once your pull request is merged, come back to main and pull the latest code.
Terminal git checkout maingit pull
Write a commit message someone can read
Say what changed, not that something changed. Your reviewer reads this before they read the code.
Like this
- Add slow mode to drivetrain
- Fix intake not stopping on beam break
Not like this
- stuff
- asdf
- fixed it
Then open the pull request
Push your branch, open the repository on GitHub, and click Compare & pull request. Describe what you built in a sentence or two. A veteran will leave a comment or three — that is the point, not a criticism.