Lesson 36 of 1455
Your First Git Commit, Explained
Git is a time machine for your code. Before we ship anything, let's learn the three commands that matter and what they actually do under the hood.
Builders · AI-Assisted Coding · ~18 min read
Git Is a Time Machine
Git is a tool that takes snapshots of your project. Every snapshot is called a commit. If you break something, you can jump back to any old snapshot. This is also why AI coding is safer than it sounds — if the AI wrecks your code, git lets you rewind.
The three-command loop
- 1git status — what has changed since the last snapshot
- 2git add <files> — mark which changes go into the next snapshot
- 3git commit -m "message" — take the snapshot with a label
Your first real commit
Six commands. That's the minimum to put code under version control.
# Step 1: tell git who you are (one-time setup) git config --global user.name "Your Name" git config --global user.email "you@example.com" # Step 2: start a repo in your project folder cd my-project git init # Step 3: write some code in a file, then: git status # see what changed git add hello.py # stage the file git commit -m "first commit" # take the snapshot # Step 4: check it worked git log # shows your commit historyWhy commit often
- Before accepting a big AI change, commit what you have — easy rollback
- After each working feature, commit — your history reads like a story
- Small commits are easier to review and revert than giant ones
- A green test + a commit is a natural save point
Undoing things
Compare the options
| Command | What it does |
|---|---|
| git restore <file> | Throw away unstaged changes in one file |
| git reset HEAD~1 | Undo the most recent commit, keep the changes |
| git checkout <commit> | Travel back to an old commit (read-only) |
| git revert <commit> | Create a new commit that undoes an old one |
Push to GitHub
Once you commit locally, you can push your code to GitHub so it lives on the internet and can be shared. Create a repo on github.com, then run the two git remote commands GitHub shows you. You now have a portfolio link you can send anywhere.
“Version control is the single most important tool in software engineering. AI did not change that.”
Key terms in this lesson
The big idea: git gives you a safety net that makes experimenting with AI code fearless. Commit early, commit often, and you can always return to a working state.
End-of-lesson quiz
Check what stuck
8 questions · Score saves to your progress.
Lesson help
Questions are best handled with a grown-up here.
For this age range, Tendril keeps freeform AI chat paused until parent/guardian consent and child-safe moderation are fully verified. Use the quiz, notes, and related lessons below, or ask a parent, guardian, teacher, or librarian to work through the question with you.
Progress saved locally in this browser. Sign in to sync across devices.
Related lessons
Keep going
Builders · 45 min
Your First Capstone — Ship a Small Project
Bring it all together. Pick one of three starter projects, plan it, build it with AI, and deploy it. You are now a builder who ships.
Builders · 30 min
Python Functions — Writing Your Own Tools
A function is a reusable chunk of code with a name. You'll write three, add type hints, and let AI suggest better names and docstrings.
Builders · 35 min
SQL Basics With AI
SELECT, WHERE, JOIN, GROUP BY. Four keywords run the data world. AI is excellent at SQL because it has read every StackOverflow answer ever.
