Chapter 1 of 14All chapters
Chapter 1 of 14
What Git is
Snapshots, not differences.
A history of snapshots
Git stores the state of your whole project each time you commit, and reuses anything that has not changed. That is why switching branches is instant and why history is hard to lose.
- Every commit has an id, a parent, an author and a message.
- The whole history lives on your machine, so most commands work offline.
Getting started
git init turns a directory into a repository, and git clone copies an existing one along with its history. Both leave you on a default branch, usually called main.