LevelUpWith

Explore / Git & GitHub: From First Commit to Team Workflow / Lesson 1

Lesson 1: Why Version Control and Your First Repository

Learn what problem version control solves by saving snapshots you can return to, then install Git, set your name and email, and create your first practice repository.

Free to read, no account needed. Part of Git & GitHub: From First Commit to Team Workflow.

By the end of this level you'll be able to

  • Explain how Git differs from copying files into folders named final_v2_REAL
  • Install Git, set your user.name and user.email with git config --global, and check them with git config --list
  • Create a practice repository with git init and confirm it exists with git status

The problem: final_v2_REAL.docx

You have probably seen a folder like this, or made one:

report.docx
report_final.docx
report_final_v2.docx
report_final_v2_REAL.docx
report_final_v2_REAL_davids_edits.docx

This is version control done by hand, and it breaks in the same ways every time. Nobody remembers what changed between v2 and v2_REAL. You can't tell which copy is the latest. If two people edit copies at the same time, someone has to merge them by eye. And the copies pile up until the folder is mostly noise.

Git solves the same problem properly. It keeps one working folder for your project and stores every saved version in a hidden database inside that folder. Each saved version is a snapshot of the whole project at that moment. Git calls it a commit. Each commit records:

  • what the files looked like
  • who made it (your name and email)
  • when it was made
  • why, in a short message you write

Think of a game's save points rather than a pile of photocopies. You keep playing in one world, and you can go back to any earlier save point whenever you want.

Copying folders Git
Many copies of the same files One working folder, history stored once
Version names you make up (v2_REAL) Every snapshot has an ID, an author, a date and a message
"What changed?" means comparing files by eye Git shows you the exact lines that changed
Merging two people's copies by hand Git merges changes and flags the lines that clash

In this level you install Git, tell it who you are, and create your first repository. You'll make your first commit in the next level.

Step 1: Install Git

Git is a free command-line program. Install it from the official site, git-scm.com:

# Windows: download "Git for Windows" from https://git-scm.com/install/windows
# or install it from a terminal with winget:
winget install --id Git.Git -e --source winget

# macOS: Apple's Command Line Tools include Git...
xcode-select --install
# ...or, if you use Homebrew:
brew install git

# Debian / Ubuntu Linux:
sudo apt-get install git

On Windows, the installer also gives you Git Bash, a terminal where the commands in this course work exactly as written. The installer's default options are fine for now.

Next, open a new terminal window and check that Git is installed:

git --version
# git version 2.56.0   <- your number may differ; any recent 2.x is fine

Gotcha: if you see git: command not found or 'git' is not recognized, the terminal you're using was opened before the install finished. Close it, open a new one and try again.

Step 2: Tell Git who you are

Every commit is stamped with a name and an email. Set them once, for every repository on your machine:

# --global means "for my user account, in every repository"
git config --global user.name "Ada Lovelace"
git config --global user.email "ada@example.com"

# Optional but recommended: name the first branch of new repos "main"
# (works in Git 2.28 and later)
git config --global init.defaultBranch main

Why the last line? Out of the box, current Git still names the first branch master and prints a hint about it. GitHub and the other big hosts use main, and the Git project plans to switch its default to main in Git 3.0. Setting it now keeps you consistent with the rest of this course.

Now check what Git has stored:

git config --list
# user.name=Ada Lovelace
# user.email=ada@example.com
# init.defaultbranch=main
# ...plus other lines your installer set

# Ask for a single value:
git config user.name
# Ada Lovelace

# See which file each setting comes from:
git config --list --show-origin
# file:C:/Users/Ada/.gitconfig    user.name=Ada Lovelace

--global settings live in a file called .gitconfig in your home folder (~/.gitconfig, or C:\Users\<you>\.gitconfig on Windows). If you run git config user.email ... without --global inside a repository, the setting applies to that repository only and overrides the global one. That's useful when one repository should use your work email.

Best practice: use the email you'll use on GitHub later. Commits are linked to accounts by email address, so a typo here means your work won't show up as yours.

Gotcha: if git config --list shows user.name twice, the last value listed wins. --show-origin tells you which file to fix.

Step 3: Create your first repository

A repository (repo) is a folder that Git is tracking. git init turns an ordinary folder into one:

# Make a practice folder and go into it
mkdir git-practice
cd git-practice

# Turn it into a Git repository
git init
# Initialized empty Git repository in /home/ada/git-practice/.git/

That message points to the key detail: Git created a hidden folder called .git. That's the database where all your snapshots will go. Your own files stay right where they are, and Git keeps its bookkeeping in .git.

Never edit or delete .git by hand. Deleting it deletes all of your history. The folder becomes ordinary files again.

Now ask Git what it sees:

git status
# On branch main
#
# No commits yet
#
# nothing to commit (create/copy files and use "git add" to track)

Each line tells you something:

  • On branch main: you're on the default line of work (branches come in level 4).
  • No commits yet: the repository exists but has no snapshots so far.
  • nothing to commit: the folder is empty, so there's nothing to save.

If you run git status in a folder that is not a repository, you get this instead:

fatal: not a git repository (or any of the parent directories): .git

git status is the command you'll run most often. Whenever you're unsure what's going on, run it.

Gotcha: don't run git init in your home folder or on your Desktop. Git would then track everything under it. Always make a dedicated project folder first.

Check your result

Run these in git-practice:

git --version                          # prints a version number
git config user.name                   # prints your name
git config user.email                  # prints your email
git status                             # "No commits yet"
ls -a                                  # the list includes .git

If all five work, you're ready for level 2, where you'll make your first real commit.

Key takeaways

  • Version control replaces piles of copies with one folder plus a history of snapshots (commits). Each commit records what changed, who made it, when, and why.
  • Install Git from git-scm.com and confirm it with git --version.
  • Set your identity once with git config --global user.name and user.email. Check it with git config --list (add --show-origin to see which file each setting comes from).
  • git init creates a repository by adding a hidden .git folder. Never delete that folder unless you mean to delete the history.
  • git status tells you where you stand. In a new repo it says No commits yet.

A 6-question knowledge check follows this lesson in the app, free and without an account.

More like this

  • GitHub Copilot (GH-300) Exam Prep

    Learn GitHub Copilot hands-on in the editor, in the CLI and on github.com, and work through every skill in the GH-300 study guide (skills measured as of August…

    Exam prep · GH-300 · Software & Engineering · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com

  • Scaling Apps Beyond the Chat Window: Part 3, Mobile Apps, Games and Growth

    Turn your first live app into a real product. Learn to choose between web and app store apps, publish a browser game, take payments safely, run and monitor a l…

    Course · Software · Software & Engineering · Capable · 24 levels · 4 free · Professionally curated by levelupwith.com

  • Scaling Apps Beyond the Chat Window: Part 2, Online, Secure and AI-Powered

    Take one small app from your GitHub repository to a public web address. You will host it on Vercel and give it a Supabase database, sign-in and file storage, w…

    Course · Software · Software & Engineering · Capable · 16 levels · 4 free · Professionally curated by levelupwith.com

  • Scaling Apps Beyond the Chat Window: Part 1, From Prompt to Project

    Move an app you built in an AI chat onto your own computer and work on it step by step with a coding agent. Save your work with Git, keep secrets out of your c…

    Course · Software · Software & Engineering · Capable · 19 levels · 4 free · Professionally curated by levelupwith.com

  • Right Chip, Right Job: CPUs, GPUs, TPUs and Beyond

    Profile a workload, place it on a roofline and pick the processor that actually suits it, whether CPU, GPU, TPU, ASIC, inference chip, NPU, FPGA or DPU. You wi…

    Beyond the Obvious · Software & Engineering · Expert · 61 levels · 4 free · Professionally curated by levelupwith.com

  • Build Your First Website with HTML and CSS

    Start from a blank file and build a real, accessible personal or small-business website that works on phones. Each level adds to the same site, covering semant…

    Course · Software · Software & Engineering · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com