What is Git?
A distributed version control system. It tracks every change to your code, lets you experiment safely, and enables multiple people to work on the same project without stepping on each other.
Git is a content-addressable, distributed version control system created by Linus Torvalds in 2005 to manage Linux kernel development. Unlike centralized VCS (SVN, CVS), every clone contains the full repository — its complete history, all branches, all tags.
Storage model: Git stores snapshots, not diffs. Each commit references a tree object (the directory state at that point), which references blob objects (file contents). Identical content is deduplicated by SHA-1 (transitioning to SHA-256). Diffs are computed on demand at display time.
Distributed semantics: a 'remote' is just another Git repository, typically reachable over SSH/HTTPS. There is no privileged 'central' server in the protocol — that role is a convention. You fetch (download) and push (upload) commits between repositories. Conflicts are detected at merge time, not at the file lock level.
Object model (4 types): blob (file content), tree (directory listing), commit (snapshot pointer + metadata + parent pointers), tag (named reference, optionally signed). Refs (refs/heads/main, refs/tags/v1.0) are pointers from human-readable names to commits. HEAD is a symbolic ref pointing to the current branch.
Why distributed beats centralized: offline work, branch-cheap experimentation (a branch is one ref pointer, not a copy), full local history (instant git log/git blame), redundancy (every clone is a backup). Trade-off: more concepts to learn upfront, no implicit locking.
Git vs GitHub vs GitLab: Git is the open-source CLI/library. Hosting providers add web UI, CI/CD, issues, pull/merge requests, access control. The Git protocol (the wire format) is identical across hosts — git push doesn't care whether the remote is GitHub, GitLab, or a bare repo on your own server.
Practice
Complete the definition:
Git stores of your project, not diffs. Each one is identified by a hash.
Grounded on https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control
Next up
Initialize a repository
`git init` turns any folder into a Git repository. A hidden `.git/` directory appears — that's where the entire history lives.