Why Git matters
Have you ever saved a file as essay_final.docx, then essay_final2.docx, then essay_final_REAL.docx? That is a manual version control system, and it gets messy fast.
Git automates that mess. It records every version of your project as a commit. You can name the commit, compare it to older versions, go back to it, or merge it with someone else's work.
Key idea: Git is a save-game system for code. You can always return to an earlier state if something breaks.
What a repository is
A repository (or repo) is a folder Git is watching. When you run git init in a folder, Git creates a hidden .git directory to store the full history of every commit.
Every commit contains three things:
- a snapshot of the files at that moment,
- a message describing the change,
- a pointer to the previous commit, forming a chain.
Because each commit points to its parent, the history is a linked list. That is how Git can rewind and replay changes.
Core commands
Most Git work follows a small loop:
git status— see what has changed.git add <file>— stage a file for the next commit.git commit -m "message"— save a snapshot with a message.git log --oneline— view the history of commits.
Git also has commands for moving between versions. git diff shows what changed between two commits, and git checkout lets you look at an older version or a different branch.
Staging area: git add does not commit the file. It moves the file into a "staging area," a holding pen for the next commit. This lets you group related changes before you save them.
See a diff
A diff is a view of exactly what changed between two versions of a file. Below, the left side is the original README.md and the right side is the same file after a teammate adds more detail.
Try it in a terminal
Walk through a tiny Git workflow. The buttons run commands on a fake repository. Watch how the file states change and how commits build a history.
Check yourself
Why does Git make you stage a file with git add before you can commit it?
Your answer:
Sample answer: Staging lets you choose exactly which changes become part of the next commit. You might have fixed two different things in the same session; staging lets you commit them separately with clear messages.
Quick quiz
1. What does git init do?
2. Which command saves a snapshot of the staged changes?
3. What does git log --oneline show?
Keep learning
Git basics give you the commands to save your own work. Next, see how branches and collaboration let teams and agents work on the same codebase safely.
Part of the “Agentic Engineering & AI Software Topics” series.