Skip to content

Introduction to Git

docs.scrimba.com
Juno

Welcome to the Git handbook! I'm Juno, and this is one of my favourite things to teach, because Git looks scary right up until the moment it clicks, and then it becomes the thing you quietly rely on all day.

We'll start from why version control exists at all, then learn the handful of commands you'll actually use, one at a time. No prior Git needed, and nothing here is ever too basic to ask about.

Take it at your own pace and we'll get there together!

Juno

Welcome to the Git handbook. I'm Ace, and I like to keep things practical. Git is the tool you'll touch every single day as a developer, so it pays to build a real feel for what each command is doing under the hood.

Every chapter is the concept, then what to do with it: run it, read the output, understand why it happened. That loop is most of what separates people who are comfortable in Git from people who are scared of it.

Juno

Welcome to the Git handbook. I'm Sol, and I've used Git long enough to have recovered work from the reflog at some deeply unreasonable hours. These are the docs for people who want to know what Git is really doing when they run a command.

Expect the object model, the pointer mechanics, and the reasons a command behaves the way it does. Git is precise once you see the model underneath, and confusing right up until you do. Read closely and question all of it, including me.

This handbook is for developers who want to understand how Git works, so it stops feeling like guesswork. Git is the tool that records your project's history: it saves snapshots of your work as you go, lets you try something risky and back out cleanly, and lets a whole team work on the same code without overwriting each other. Almost every professional codebase lives in Git, so being comfortable with it is one of the most useful skills you can pick up early.

One distinction to get straight before anything else, because it trips up nearly everyone: Git and GitHub are not the same thing. Git is the version-control tool that runs on your own machine. GitHub is a website that hosts Git repositories and adds collaboration on top. You can use Git with no GitHub account at all. The next chapter, What is Git, pulls those apart properly and tells the story of where Git came from, which is a good one: it was built in 2005, in a hurry, by the person who created Linux.

What is a repository?

A repository is a project folder Git tracks, along with the full history of every commit made in it. Your first repository covers creating one.

The approach here is to explain the tool underneath the commands. Anyone can memorize git add, git commit, git push and get by on a good day. The distance between that and being comfortable is understanding what those commands do to your repository, so that when something looks broken you can reason about it instead of guessing. So this handbook spends real time on the mental model, staging, branches as pointers, what a merge actually does, before and alongside the commands, because the model is what turns Git from scary to clear.

You do not need any prior Git experience to start, and you do not need anything installed up front: Your first repository begins with opening a terminal and getting Git onto your machine, and everything Git-specific is introduced as it comes up. If a term ever loses you, the Glossary keeps a short definition of every piece of Git vocabulary in these docs. These docs teach the concepts in depth; Scrimba's course is the guided, build-along version of the same material.

Meet your guides

These docs are hosted by three guides, and you pick which one shows you around. The teaching is the same for everyone; your guide sets how deep each section goes and the voice it's told in.

Switch guide any time from the picker at the top of any page, or open Preferences at the bottom right to change your guide, language, or font size.

Prefer to learn by building?Scrimba's Learn Git and GitHub course covers the same ground hands-on, across 39 short interactive lessons.