First steps · lesson 1 of 8
Commands and ideas in this lesson
AVersion controla history of saved steps
BRepositorya folder plus its history
CGitthe tool this course teaches

Why version control

Last updated

Everyone who has saved recipes_FINAL_v3_really.docx already knows the problem version control solves. In this lesson you'll see what it does instead, where Git came from, and why Git and GitHub are two different things.

By the end of this lesson you can

  • Say what version control is for, in your own words
  • Name three things you can do with a history that you can't do with copies
  • Tell Git (a tool on your computer) apart from GitHub (a website)

recipes_FINAL_v3_really.docx

Ana is 15. Her grandmother, Lola Remy, keeps the family's recipes in a notebook held together with tape, and Ana has decided to type them up before the notebook falls apart. Her cousin Carla wants to help, and Lola Remy wants to check every recipe, because she knows exactly when "a little salt" became "2 tbsp".

Most people keep track of changes the way Ana starts out: by making copies. Step through a year of her recipes folder.

The recipes folder

  • recipes.docx
1 of 7 January. Ana types Lola Remy’s first recipes into recipes.docx.

Copies don't say what changed, who changed it, or why. Two people editing their own copies have to join them by hand. And sooner or later, someone opens the wrong one.

A history you can go back through

Version control is a tool that keeps a history of a folder for you. Each time you reach a point worth keeping, you save a step in the history, with a short note. The tool remembers what every file looked like at every step.

A folder with its history is called a repository (people say "repo"). With one, you can:

  • look back: see every step, who made it, when, and the note that says why;
  • compare: see exactly which lines changed between any two steps;
  • undo: bring back one file, or the whole folder, as it was at any step;
  • try things safely: work on an idea to the side, and throw it away or keep it.

Version control works best on plain text, such as recipes typed in a simple format, programs, or notes, because it can show the exact lines that changed. This course's recipes are plain text files, so you'll always see what each change did, even if you never write a line of code.

Working with others without overwriting

Copies break down fastest when two people work on the same files. Carla edits the pancit, Ana edits the adobo, and both of them fix a typo in the introduction. With copies, whoever saves last wins, or someone spends an evening joining the files by hand.

Version control joins their work for them. Each person works on their own copy of the repository, and the tool brings the changes together line by line. When two people change the same line differently, it stops and asks which version to keep, instead of quietly losing one. That's called a conflict, and Stage 3 shows how calm it can be.

This is why almost every software team uses version control, and why it's just as useful for a thesis, a website or a family recipe book.

Where Git came from

This course teaches Git, the most widely used version control tool. It was written in 2005 by Linus Torvalds, who also started Linux, when the Linux project lost free use of the tool it had been using. The goals were speed, a simple design, and support for thousands of people working at once without one central server. Pro Git, the free book by Scott Chacon and Ben Straub, tells the story in its first chapter.

Two things about Git matter from day one:

  • Every copy is complete. When you get a copy of a repository, you get its whole history, not just the latest files. You can look back, compare and save new steps without an internet connection.
  • It's free and open source, and it runs on Windows, macOS and Linux. You'll install it in lesson 1.3.

In this course, you'll type Git commands in a sandbox in the page. It keeps a real Git repository in the page, so what you see is what Git does on your own computer.

Spot the trap: "Git and GitHub are the same thing"

Spot the trapAna and Joaquin

Ana tells her classmate Joaquin she's going to start using Git for the recipes. Joaquin says: “Then you need a GitHub account first. Git is the website where you put your files.”

What happens if…

Git is the tool. GitHub is a website that hosts Git repositories and adds features for teams, such as pull requests (Stages 4 and 5). Mixing them up is the most common confusion beginners have, and the course keeps them apart: everything until Stage 4 needs only Git.

Check what you learned

What does version control keep that a folder of copies doesn’t?
Ana and Carla both changed the same line of the adobo recipe, differently. What does version control do?
Which sentence is right?

Sources

Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.

All sources for Simple Git