Your First Repo: init, add, commit
In the first three lessons we built the picture in our heads: why version control exists, and how Git thinks about your project. Now we touch the tool for the first time and create a real save. The thing that confuses people most at the start is that Git doesn't 'save' files directly — there's one i
Think of staging like packing a box before you seal and ship it: git add chooses what goes into the box, and git commit seals it and sets it into history forever.
- Working tree
- The folder where your files live and you edit them. A change here is not yet saved in Git until you add it and commit.
- Staging area
- An in-between stop where you pack exactly which changes go into the next save. git add puts a change here, like placing an item in the box.
- git init
- Starts tracking versions in the current folder. It creates a hidden subfolder called .git that will hold all the history.
- git add
- Moves changes from the working tree into staging — that is, chooses what goes into the next save.
- git commit
- Seals whatever is in staging into a permanent save (a commit) in history, with a short message explaining the change.