1.3.1. Repositories: The Project Container
💡 First Principle: A repository (often shortened to "repo") is the container that holds a project's entire tracked history — every file, and every version of every file, going back to the first commit. Nothing in Git exists outside of a repository; a repository is the boundary that defines what's being tracked together as one project.
On your own machine, a repository is a regular folder plus one hidden subfolder, .git, where Git actually stores all of the history, commits, and branch information. Everything you see in the folder — your code, your README, your images — is called the working directory; it's your current checked-out view of one point in that history. Creating a repository, committing to it, branching it, and inspecting its history are all local operations against that .git folder — none of them touch the network. When you "clone" a repository from GitHub, you're downloading both the working directory and the entire .git history behind it, not just the current files, and only that download step (or a later push/pull) needs a connection.
⚠️ Exam Trap: You do not need an internet connection to use Git day-to-day. Committing, branching, viewing history, and diffing are local operations against the .git folder. Only publishing that history to a remote host like GitHub — a push, pull, or fetch — requires a network connection.
Reflection Question: If you cloned a repository, disconnected from the internet, and then made three commits and created a new branch, would any of those actions fail? Why or why not?