git clone: download a whole project
Files and complete history, in one command.
git clone downloads a remote repository — every file and every commit — and wires up the remote for you.
01What clone does
You found a project on GitHub and want to work on it. git clone <url> downloads it — and this is the part people underrate: not just today's files, but the entire photo album. Every commit anyone ever made on that project, the whole story, lands on your disk in one go.
That is why cloning feels heavy the first time and instant afterwards — the history is real data. And it is why you can explore a cloned project's past offline, on a plane, in a tunnel: the album came with you.
git clone https://github.com/flawme/demo-project.git02What you get
Clone creates a new folder named after the project, puts the current files inside, and — the detail that saves you three commands — remembers where it all came from. The remote origin is already connected, so you can push your changes back or pull updates immediately. No git init, no git remote add: clone did everything.
The first moves inside a fresh clone are the natural ones: ls to see what is here, cat README.md to read the instructions the author left, git log --oneline to see the story so far. You are holding a complete copy of a project that took other people years — treat the log like a book's table of contents.
- —the files — the current state of the project
- —the history — every commit, readable offline
- —origin — the remote, already configured
A zip download gives you the files only — a snapshot with no memory. Clone gives you the files plus the album plus the connection. Same size, different object entirely.
03The difference from init
git init starts a brand-new album from nothing. git clone copies an existing one. Every repository you ever touch will have begun one of those two ways, and you can tell which by looking: a cloned repository already has commits and a configured remote; an inited one starts empty and alone.
A clone is a full repository, not a view of one. You can commit to it freely. Whether your commits can be pushed back depends on permissions — that is a GitHub matter, not a git one.
Practice
A tiny project is hosted at a fake URL. Bring it home.
01.Clone https://github.com/flawme/demo-project.git
hint: Type: git clone https://github.com/flawme/demo-project.git
02.Confirm the files arrived — look around.
hint: Try: ls then cat README.md
03.Read the project's history.
hint: Try: git log --oneline