Skip to content

What Is Git?

An introduction to version control and why Git is the industry standard for tracking changes.

What you'll learn

  • What version control is and why every developer needs it
  • How Git tracks changes to files over time
  • The difference between Git (the tool) and GitHub (the platform)
  • Distributed vs centralized version control systems

Concept

What Is Version Control?

Version control is a system that records changes to files over time so you can recall specific versions later. Without it, you end up with folders full of files like report_final.docx, report_final_v2.docx, report_final_REALLY_FINAL.docx — a nightmare to manage.

Version control lets you:

  • Track history — see who changed what, when, and why
  • Revert — undo mistakes by going back to any previous state
  • Branch — work on features or experiments without affecting the main code
  • Collaborate — merge work from multiple people without overwriting each other

What Is Git?

Git is a distributed version control system created by Linus Torvalds in 2005 (the same person who created Linux). It is the de facto standard for software development — over 90% of developers use it.

Git stores snapshots of your project, not just the differences between files. Every commit is a full picture of what your project looked like at that point in time, which makes branching and reverting fast and reliable.

Distributed vs Centralized

Older systems like SVN are centralized — there is one central server, and every developer checks files out from it. If the server goes down, nobody can work.

Git is distributed — every developer has a complete copy of the entire repository history on their machine. You can commit, branch, and view history offline. You only need a network connection to push or pull from a remote.

Git vs GitHub

This is a common point of confusion:

  • Git is the command-line tool that runs on your computer. It does the actual version control work.
  • GitHub is a web platform that hosts Git repositories and adds collaboration features (pull requests, issues, code review). Other alternatives include GitLab, Bitbucket, and Gitea.

You can use Git without ever touching GitHub — for example, to track a personal project locally. GitHub is just one place to store and share your Git repositories.

Why Learn Git?

Git is non-negotiable in professional software development. Every job posting, every open-source project, every team workflow assumes you know it. Learning the fundamentals early will save you from losing work and from painful conflicts later.

Example

              # Check if Git is installed and see its version
git --version

# Configure your identity (do this once per machine)
# These get attached to every commit you make
git config --global user.name "Ada Lovelace"
git config --global user.email "[email protected]"

# See all your Git configuration
git config --list

# Get help on any Git command
git help init
git add --help
            

These are the first commands you run after installing Git. The config commands set your name and email, which are embedded in every commit so people know who made each change.

Try it

Common mistakes

The mistake

Confusing Git with GitHub

The fix

Git is the version control tool that runs locally; GitHub is a web platform that hosts Git repos. You can use Git without GitHub, but you cannot use GitHub without Git.

The mistake

Not configuring user.name and user.email before committing

The fix

Run git config --global user.name 'Your Name' and git config --global user.email '[email protected]' before your first commit, or Git will refuse to commit or use a default identity.

Related Snippets

Related Cheatsheets

Look up unfamiliar terms

A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.

View glossary

Build real projects

Apply what you learned by building guided projects with starter code and solutions.

View projects

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors