In this chapter
We'll learn how a whole team shares one project: local and remote repositories (your copy and the library's master copy), GitHub and GitLab, and cloning — getting your own full copy of a project, history and all.
The Problem in Real Life
Anna's laptop now has Liam's work restored. But when Liam opens his own laptop, he doesn't see her fix — and she doesn't see his latest change from five minutes ago. "We each have our own copy of the whole repository," she says slowly. "So how do we ever agree on which one is real?"
John opens a web page: BlueTicket's project on GitHub, with the same history she saw in her terminal. "Everyone's copy syncs with this one. It's the master copy in the library."
Everyone has their own full copy. There's one shared copy everyone agrees on.
John
Everyone's Own Copy vs. One Shared Copy
Many copies of one project
Every developer has a full repository on their laptop. They need a way to share changes.
A shared place online
Teams keep one shared copy on a hosting service, so everyone can send and receive changes.
Joining a project
A new developer needs a way to get the whole project, with all its history, in one step.
Remote Repositories, GitHub, GitLab and Cloning
The library master copy analogy: imagine a team writing a book together. The library keeps the official master copy. Each writer borrows a complete photocopy — every page and every past draft — and works on it at home. When they finish a chapter, they bring their changes to the library and add them to the master copy. Before starting new work, they update their photocopy with everyone else's changes. Git works exactly like this.
- Local repository — your photocopy: the repository on your own computer, with the full history. You can commit, look at history and make branches without any internet connection. Git is distributed: every developer has a complete copy, not just the latest files.
- Remote repository — the library's master copy: a copy of the repository on a server that the whole team shares. Developers push their commits to it and pull others' commits from it (next chapter). A repository can know about several remotes; the main one is usually called
origin. - GitHub: the most popular website for hosting remote Git repositories. Besides storing code, it adds tools for teams: pull requests for reviewing changes before they're merged (Act 18), issue tracking, and automation (Act 19). Many open-source projects live on GitHub — anyone can read their code.
- GitLab: a very similar service, popular in companies, which can also be installed on a company's own servers. Bitbucket is another. They all host the same Git repositories; the differences are in the extra team tools.
- Clone — photocopy the whole book: cloning downloads a complete copy of a remote repository — every file and every commit — onto your computer, and remembers where it came from. It's how you start working on any existing project:
git cloneonce, then work locally.
| Feature | Local repository | Remote repository |
|---|---|---|
| Library version | Your photocopy at home | The library's master copy |
| Lives on | Your computer | A server (GitHub, GitLab) |
| Works offline? | Yes | Needs the network to reach |
| Who uses it | Just you | The whole team |
| Usual name | (your copy) | origin |
| Name | What it is |
|---|---|
| Git | The version control tool on your computer |
| GitHub | A website hosting Git repositories, with pull requests, issues and automation |
| GitLab | A similar hosting service, also installable on a company's own servers |
| Bitbucket | Another Git hosting service |
One shared copy, many local copies
Remote repository (origin)
on GitHub — the library's master copy
Anna's local repository
full copy on her laptop
Liam's local repository
full copy on his laptop
John's local repository
full copy on his laptop
git clone https://github.com/blueticket-example/blueticket-app.git# downloads every file and every commit into a new foldercd blueticket-appgit remote -v# origin https://github.com/blueticket-example/blueticket-app.git (fetch)# origin https://github.com/blueticket-example/blueticket-app.git (push)
Git vs. GitHub — a common confusion: Git is the tool that records history on your computer. GitHub is a website that hosts Git repositories for sharing. You can use Git without GitHub (on your own, or with GitLab), but GitHub is built on Git. Like email and Gmail: email is the system; Gmail is one service that provides it.
Anna remembers Act 04 — the very first thing she did with BlueTicket's code was git clone. Now she understands what it did: it photocopied the library's master copy, history and all, onto her laptop. Her restore commit exists only in her photocopy so far. To give it to the team, she needs to send it to the master copy. Liam needs to fetch it into his. Those are the everyday commands — next.
Key Takeaway
Git is distributed: every developer's local repository is a complete copy with full history, like a photocopy of a book. A remote repository is the shared master copy on a server, usually called origin, hosted on services like GitHub or GitLab, which add team tools such as pull requests. Cloning downloads a full copy of a remote repository to start working on it. Git is the tool; GitHub is a website that hosts Git repositories.
Why This Matters
Every team project you join starts with a clone, and every day ends with sharing your commits to the remote. Understanding that everyone has a full local copy — and that the remote is just the agreed shared one — explains why you can work offline, why changes don't appear on teammates' laptops until they're pushed and pulled, and why GitHub's pull requests are where team review happens (Act 18).
Anna understands the shape now: her photocopy, Liam's photocopy, and the library's master copy. Time to learn the handful of commands she'll type every single day to keep them in sync.
