Git — Save and Track Your Work
Free skillWhat this is and why it matters
Git saves versions of your work, so you can go back, compare, and work with other people without overwriting each other.
Every company that builds software uses Git. Infrastructure code, Docker files, CI pipelines — all of it lives in Git. It is the one tool you cannot skip.
In this lesson you do the complete core workflow: start a repository, save changes, make a branch, and merge it back.
The 3 places your work lives
Working folder — your files as you edit them. Staging area — the “to be saved” box, filled with git add. History — saved snapshots, created with git commit.
The two-step save (add, then commit) feels odd at first. It lets you choose exactly which changes go into each snapshot.
The commands
git init — start tracking this folder.git status — what is new, changed or staged. Run it often; it tells you what to do next.git add file — stage a file. git add . stages everything.git commit -m "message" — save a snapshot with a short message.git log — list snapshots, newest first.
Branches: try ideas safely
A branch is a separate line of work. git branch feature creates one, git checkout feature switches to it. Files you add on the branch do not appear on main until you git merge feature from main.
Common mistakes
- Forgetting
git add: the commit says “nothing to commit”. - Vague messages like “fix”. Say what changed and why.
- Working on
maindirectly. Make a branch first.
Practice in the browser
The practice terminal behaves like real Git: untracked files show up in git status, branches keep their own history, and files appear and disappear when you switch branches.
Quick check — try it yourself
Question: You created idea.txt on the feature branch and committed it. After git checkout main, will ls show idea.txt?
Show answer
No. The file belongs to the feature branch history. It appears on main only after git merge feature. Try it in the practice terminal to see it happen.