Tutorial

Git Tutorial

Learn Git from scratch: version control basics, branching, merging, rebasing, remotes, GitHub workflow, and advanced techniques, with hands-on examples and quizzes.

17 lessons in this tutorial

1

Introduction to Git

What Git is and why version control matters. Distributed vs centralised, how Git stores history, and the terms you need before anything else.

2

Installing Git

Install Git on macOS, Linux and Windows, then configure what matters. Identity, default branch, editor, and .gitattributes for line endings.

3

Git Basics

The everyday Git loop, init, clone, status, add, commit, log and diff, with the staging area explained and the pre-commit checks worth making a habit.

4

Git Branching

What a branch actually is, git switch vs checkout, HEAD and detached HEAD, deleting local and remote branches, renaming, and naming conventions that tooling can use.

5

Git Merging

Fast-forward vs three-way merges, resolving conflict markers step by step, --no-ff and squash merges, and aborting a merge that went wrong.

6

Git Rebasing

Replay commits for a linear history. Basic and interactive rebase, squashing, recovering with --abort and reflog, force-with-lease, and when to merge instead.

7

Git Remote

Work with remotes confidently. Fetch vs pull, fixing rejected pushes without force, upstream tracking, pruning deleted branches, and origin vs upstream in forks.

8

Git Stash

Park work in progress safely. Apply vs pop, untracked files, naming and inspecting stashes, and when a branch is the better tool.

9

Undoing Changes in Git

Undo anything in Git. Restore, reset soft/mixed/hard, revert for shared branches, clean for untracked files, and recovering a bad reset with reflog.

10

Git Tagging

Mark releases properly. Lightweight vs annotated tags, why push ignores tags, deleting safely, tagging old commits, and how tags drive semantic-versioned releases.

11

GitHub Workflow with Git

The pull request workflow end to end. Forking vs cloning, keeping a branch current, squash vs merge vs rebase, and reviewing well.

12

Advanced Git

Cherry-pick, bisect, reflog and blame. The advanced commands that recover lost work and find regressions fast, and which of them are worth learning first.

13

Git Hooks

Automate checks at commit and push time. Where hooks live, why they never reach your team, client vs server side, --no-verify, and setting up Husky properly.

14

Git Workflows

GitFlow, GitHub Flow and trunk-based development compared honestly, which suits which team, why long-lived branches hurt, and feature flags.

15

Git Aliases and Configuration

Configure Git once and stop fighting it. Config scopes, per-directory work identities, aliases worth having, and the defaults to change.

16

Git Submodules

Pin one repository inside another. Cloning with --recurse-submodules, the two different update commands, detached HEAD, and subtrees compared.

17

Git Commit Messages

Write commit messages that stay useful: the imperative summary, the body that records why, Conventional Commits, and enforcing it with commitlint.