git clone
What gets copied. What gets created.
git clone is not magic — it is a precise sequence of steps. Understanding exactly what it creates locally demystifies everything about how remotes, tracking branches, and git pull work.
The Clone Sequence
Step through each phase to see what Git creates on your machine.
Commit history
Branches
The Five Things Clone Does
Downloads all objects
Every blob, tree, and commit ever created on the remote is downloaded into .git/objects/. You get the full history, not just the latest snapshot.
Creates remote-tracking branches
One file per remote branch is written to .git/refs/remotes/origin/. These are the read-only bookmarks recording where each remote branch currently points.
Writes .git/config
Adds [remote "origin"] with the URL and refspec, and [branch "main"] with the tracking config. This is how git pull knows where to fetch from.
Creates a local branch
Creates .git/refs/heads/main pointing to the same commit as origin/main. This is your first local branch — it tracks the remote.
Checks out the working directory
Walks the HEAD commit's tree and writes every file to disk. You end up with a populated working directory ready to use.