Summary
Git is a distributed version control system that tracks changes to a project over time, allowing developers to revert to any previous state, work on separate features in parallel, and collaborate without overwriting each other’s work. For game developers, Git is the standard tool for protecting work-in-progress, coordinating in teams, and maintaining a history of every design decision. Understanding how Git actually stores data — and the three states a file moves through — makes every Git command easier to reason about.
Key ideas
Snapshots, not differences
Most version control systems store files as a base version plus a list of changes (deltas) over time. Git works differently: each commit is a snapshot of the entire project at that moment. If a file has not changed since the last commit, Git stores a link to the identical previous version rather than duplicating it.
This snapshot model means:
- Switching between versions is fast — Git just reads the snapshot
- Checking history does not require reconstructing files from a chain of changes
- The project is always in a complete, self-consistent state at every commit
Nearly everything is local
Git stores the entire project history in the .git folder on your machine. This means:
- You can create commits, view history, and switch branches without an internet connection
- Operations like
git logandgit diffrun instantly from local data - You only need a network connection when explicitly syncing with GitHub (
push/pull/fetch)
Integrity through checksums
Every file and commit in Git is identified by a SHA-1 hash — a 40-character hexadecimal string like 24b9da6552252987aa493b52f8696cd6d3b00373. Git generates this from the file or commit contents. If any data changes even slightly, the hash changes. This means Git always knows whether any data has been corrupted or tampered with.
The three states
Every file tracked by Git is in exactly one of three states:
| State | Meaning | Where it lives |
|---|---|---|
| Modified | Changed since last commit, but not yet marked for the next one | Working tree |
| Staged | Marked to be included in the next commit | Staging area (index) |
| Committed | Saved permanently in the Git database | Git directory (.git/) |
The workflow is: modify files → stage the ones you want → commit the staged snapshot.
The three areas
Corresponding to the three states, a Git project has three areas:
Working Tree Staging Area Git Directory
(your files) (.git/index) (.git/)
edit → git add → git commit
files files snapshot
stored here
Working tree — the files you actually edit. This is what you see in your file explorer and Unity’s Project window. When you open a script in Visual Studio, you are editing the working tree.
Staging area (also called the index) — a file inside .git/ that records exactly which changes will go into the next commit. You populate it with git add. This allows you to commit only some of your changes — for example, committing a player movement fix without including an unfinished enemy AI you have been experimenting with.
Git directory — the .git/ folder at the root of your project. This is where Git stores all the snapshots, history, and configuration. Never modify this folder manually. When you clone a repository, Git creates this folder. Do not add .git/ to your Unity project.
Why this matters for Unity projects
Unity generates many temporary files (Library/, Temp/, obj/) that do not need to be version-controlled and would make the repository enormous. Understanding that Git only tracks files you explicitly tell it to — via git add or a .gitignore configuration — means you can keep your repository clean and fast.
The critical files to track in a Unity project are:
Assets/— all your scripts, prefabs, scenes, textures, audio, and artProjectSettings/— quality settings, input manager, physics layersPackages/— package manifest for Unity Package Manager
Everything else (compiled code, caches, IDE files) should be ignored. See git-github-unity for the complete Unity .gitignore.
Related
- git-workflow — the daily commands for working with Git
- git-branching — creating and merging branches
- git-github-unity — setting up GitHub for a Unity project
- source-progit