Git & Version Control

Git Fundamentals

The core loop: stage, commit, push, pull.

30 min read beginner 3 objectives

Status

Not started

What you will learn

  • Understand the three trees
  • Make clean commits
  • Push and pull

New to this? Start here

The basics, in plain English

Git is a time machine and a save system for code. As you work, it records snapshots of your files so you can go back, see what changed, and work with others without overwriting each other. A snapshot is called a commit.

Version control
A system that tracks every change to your files over time so nothing is lost.
Git
The most popular version control tool, used by nearly every software team.
Repository (repo)
A project folder that Git is tracking, including its full history.
Commit
A saved snapshot of your files at one moment, with a short note about what changed.
Staging
A waiting area where you pick which changes go into the next commit.
Push / pull
Push uploads your commits to a shared server; pull downloads others’ commits.
01

Three trees

Working directory, staging area (index), and repository. git add moves to staging, git commit records a snapshot.

Try it yourself

bash
$git status
See what has changed and what is staged.
$git add -p
Review and stage changes one chunk at a time.
$git commit -m "feat: add health check"
Save the staged changes with a clear message.
$git push origin main
Upload your commits to the main branch on the remote.
↳ lines explain what each command does — only the commands get copied

Finished this topic?

Mark it done to earn 100 XP and keep your streak alive.