Git

A version control tool that records the history of your project.

Git keeps every saved version of your project, lets you try changes on separate branches, and lets several people work on the same code. Linus Torvalds created it in 2005 for Linux kernel development, and today most software teams use it.

  • Beginner
  • 8 lessons
Not started yet
Start lesson 1

Lessons

  1. What Git Actually SolvesLearn what version control is and why it is useful. Instead of keeping copies like final.doc and final_v2.doc, Git keeps every saved version with a name, date and description you can return to.
  2. The Core Loop: add & commitLearn the everyday loop of editing, staging and committing. Once the staging area makes sense, most other Git commands are easier to follow.
  3. BranchesLearn to create, switch between and merge branches. A branch lets you work on a change separately; if it works you merge it into main, and if not you delete it.
  4. Merge ConflictsWhen two branches change the same line, Git cannot tell which version you want and asks you to choose. Learn to read conflict markers and resolve them.
  5. Remotes: push, pull & GitHubLearn to push your work to a remote copy on a server such as GitHub and pull other people's changes. Remotes are how teams share code and how you back up your work.
  6. Undoing ThingsLearn the main ways to undo changes in Git, from fixing your last commit message to recovering work you thought you had lost.
  7. Reading HistoryLearn to search your project's history to find who changed a line, what changed last week, and which commit introduced a bug.
  8. Git CheatsheetThe commands you run daily, plus the rescue toolbox — one page.

Install it on your own computer

Git is a command-line tool. After installing it, set your name and email; Git records them on every commit you make.

Bash
winget install Git.Git
# Or download from https://git-scm.com

# Then, in a new terminal:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git --version

What people build with Git

Learn the basics first, then pick up these tools when a project needs them.

Practical uses

  • Track and review changes safely
  • Collaborate through branches and pull requests
  • Investigate regressions and restore history
  • Automate releases and deployment workflows

Projects to try

  1. Version a writing project
  2. Practice branching with a team repo
  3. Build a release workflow
  4. Write a custom Git hook

Common tools and packages

GitHubGitLabBitbucketLazygitGit LFSpre-commitHuskyConventional Commits

Well-known software

Linux kernel developmentChromium sourceKubernetesReactHomebrewNearly every modern codebase