Skip to content
BENIBIX Learn

Version Control and Git

Level 1 · Your first commits

What version control is, and why most coders use Git for it. How one hidden folder in your repo holds your whole history.

Course contentsLesson 1 of 13

After this lesson you can

  • Say what version control does
  • Tell Git apart from GitHub
  • Start a new repository

9 mincovers 3 glossary entries

What Git does, and where it keeps your history

Version control is a way to save every change to a set of files, so you can go back to any of them. Git is the tool almost everyone uses for it. It was written in 2005 to look after the code of Linux, and it is free. Every change you save records who made it, when and why.

Without it, people save copies by hand. A folder fills up with names like site-old, site-new and site-new-2. Nobody remembers which copy is which, or what changed between them. Two people editing at once is worse, because the last one to save wipes out the other's work.

A repository, or repo, is a project folder that Git is watching. It looks like any other folder, with your files in it. Inside sits one hidden folder called .git. That folder holds the whole history of the project. Delete it, and your files stay, but every saved version is gone.

You make a repo with one command, git init, run inside the folder. Git creates the .git folder and starts with an empty history. To copy a repo that already exists somewhere else, you use git clone instead. Both ways end the same: a folder that Git is tracking.

Git keeps the full history on your own computer. That makes it fast, and it works with no internet at all. Each person on a team has a complete copy, not just the latest files. If the shared copy on a server is ever lost, any one of those copies can rebuild it.

Git is not GitHub. Git is the program on your computer that saves the history. GitHub is a website that keeps a copy of a repo online, so a team can share it. You can use Git for years without ever making an account on any website.

Git is mostly used for code, but it works for any plain text. People track books, notes and settings files with it. It is weaker with big files that are not text, like videos and photos. It can store them, but it cannot show what changed inside them.

console
$ git --version
git version 2.53.0
$ git init -b main shop
Initialized empty Git repository in /home/emma/shop/.git/
Check that Git is there, then make a repo called shop. The -b main part names its first branch main.
Your files sit on top where you can see them. The hidden .git folder holds every version you ever saved.

Worked example

Lucy keeps her book in Git

Lucy writes a book of 12 chapters in plain text files. She runs git init in the book's folder and saves a version after each writing session.

After 3 months she has 140 saved versions. When her editor asks why chapter 4 got shorter, Lucy finds the day and the note in under a minute.

The words for this lesson3

Check yourself

What is the difference between Git and GitHub?

Finished this lesson?

Marking it complete also marks its 3 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.