Chapter Six

Remotes and Large Repositories

How Git talks to other copies of a repository — remotes and tracking branches, fetch, pull, and push, tags and releases, submodules and subtrees, and the techniques that keep large or giant repositories workable.

5 topics

Everything so far has been local: snapshots, branches, and history that live entirely in your own .git directory. This chapter is where Git meets the network. The handful of commands that cross the wire — fetch, pull, push — are few, but the model behind them, especially the idea that origin/main is a local snapshot rather than a live view of the server, is where most remote confusion comes from.

The second half is about scale. Tags mark the commits you ship, submodules and subtrees compose repositories together, and LFS, shallow clones, partial clones, and sparse-checkout keep large or giant repositories from becoming unworkable. Get these right and collaborating at any size stays predictable.

Local ↔ remote — push uploads; fetch updates origin/main; pull is fetch + merge/rebase
Local repo
Remotevia push
origin/mainvia fetch (read-only)
Local branchmerge / rebase = pull

Topics in This Chapter