cd ~/tutorials/git

Git Tutorial

Learn Git 2.56 from zero: commits, branches, merges and rebases, remotes and pull requests, undoing mistakes, tags, hooks, team workflows, submodules, good commit messages and every new command added up to the road to Git 3.0.

18 lessons · 132 min

Start the course →

This course takes you from “why not just copy the folder?” to working confidently in a shared repository: branching, reviewing, fixing mistakes and automating checks. All along you version the code of Orbit, the small notes app from the other courses on this blog: its API, its deploy script and its CI pipeline.

Every command runs on your own machine, with no account needed until lesson 11, where you push Orbit to GitHub (GitLab works the same way). Each lesson has commands you can copy, three short exercises to check what you learned and answers to the questions people ask most.

Before you start: you need a terminal. If commands like cd, ls and cat are new to you, take the first lessons of the Linux Tutorial first. Lesson 2 shows how to install Git on Windows, macOS and Linux.

The examples target Git 2.56 (September 2026). Git moved fast in the last year: a new git history command for editing commits, hooks you define in config, git branch --delete-merged, git add --resolved and the first steps toward Git 3.0. Each lesson points out which version a feature arrived in, and the last lesson collects all the news in one place.

ls ./lessons

  1. Introduction to GitWhat Git is, the problems version control solves, how Git records history as snapshots, centralized versus distributed systems, where Git shows up in DevOps work and what changed in Git up to version 2.56.beginner9 min readCompleted
  2. Installing GitInstall Git on Windows, macOS and Linux, set your name and email, choose an editor and a default branch name, connect to GitHub or GitLab with SSH keys, handle line endings and understand where Git keeps its settings.beginner8 min readCompleted
  3. Git BasicsThe three areas of Git, the everyday loop of status, add and commit, reading history with log and show, comparing changes with diff, staging part of a file, ignoring files with .gitignore and renaming or deleting tracked files.beginner8 min readCompleted
  4. Git BranchingWhat a branch really is, creating and switching branches with git switch, HEAD and detached HEAD, listing and comparing branches, naming conventions and cleaning up merged branches with the new git branch --delete-merged from Git 2.56.beginner7 min readCompleted
  5. Git MergingHow git merge combines branches, fast-forward versus three-way merges, why and when conflicts happen, reading conflict markers with zdiff3, resolving and finishing safely with git add --resolved from Git 2.56, aborting a merge and squash merges.intermediate7 min readCompleted
  6. Git RebasingWhat git rebase does to commits, rebase versus merge, keeping a feature branch up to date, cleaning commits with interactive rebase, fixup commits and autosquash, stacked branches with --update-refs, handling conflicts and the golden rule of never rebasing shared history.intermediate8 min readCompleted
  7. Git RemoteWorking with remote repositories: clone, origin and remote-tracking branches, fetch versus pull, pushing and upstreams, ahead and behind, several remotes for forks and mirrors, pushing to remote groups (Git 2.55), and shallow and partial clones for big repositories.beginner7 min readCompleted
  8. Git StashPut unfinished work aside with git stash, list and inspect stashes, apply versus pop, include untracked files, stash only part of your changes, turn a stash into a branch, resolve stash conflicts and move stashes between machines with export and import from Git 2.51.beginner6 min readCompleted
  9. Undoing Changes in GitPick the right undo for every situation: git restore for files, git commit --amend, git reset soft, mixed and hard, git revert for shared history, git clean for untracked files, the reflog safety net and the new git history command for rewording, splitting, fixing and dropping commits.intermediate8 min readCompleted
  10. Git TaggingMark releases with tags: lightweight versus annotated tags, semantic versioning, tagging older commits, pushing and deleting tags, signed tags, git describe for build versions and how CI pipelines use tags to trigger releases.beginner6 min readCompleted
  11. GitHub Workflow with GitThe everyday pull request flow from issue to merge: branch, commit, push, open a pull request with the gh CLI, review and update it, keep it current, merge options, branch protection and CI checks, forks for outside contributors and how the same flow works on GitLab.intermediate7 min readCompleted
  12. Advanced GitThe commands that turn Git into a debugging tool: cherry-pick, git bisect with automatic reset (Git 2.56), blame and ignoring formatting commits, searching history with log -S and -L, git last-modified (Git 2.52), worktrees for parallel work, sparse checkout and repository maintenance.advanced8 min readCompleted
  13. Git HooksAutomate checks with Git hooks: which hooks exist, writing pre-commit and commit-msg scripts, sharing hooks with core.hooksPath, the new config-based hooks from Git 2.54, running hooks in parallel with Git 2.55, the pre-commit framework and server-side enforcement.advanced8 min readCompleted
  14. Git WorkflowsCompare the branching strategies teams actually use: trunk-based development with feature flags, GitHub flow, GitLab flow with environment branches, Git Flow with develop and release branches, release branches for maintained versions, and how to choose one for your team and your deploy pipeline.intermediate6 min readCompleted
  15. Git Aliases and ConfigurationMake Git yours: the git config commands, aliases for everyday commands and shell aliases, conditional includes for work and personal identities, settings that improve diffs, merges and pushes, status.compareBranches (Git 2.54), the file system monitor on Linux (Git 2.55) and a starter .gitconfig.intermediate6 min readCompleted
  16. Git SubmodulesInclude one repository inside another with submodules: how they pin a commit, adding them, cloning with --recurse-submodules, updating to new versions, working inside a submodule, removing one cleanly, using them in CI, and when git subtree or a package manager is the better choice.advanced7 min readCompleted
  17. Git Commit MessagesWrite commit messages people can use: the subject and body format, the imperative mood, explaining why, Conventional Commits for changelogs and versioning, trailers like Co-authored-by and Signed-off-by, linking issues, and signing commits with SSH keys so they show as verified.beginner7 min readCompleted
  18. What’s New in Git (2.52 to 2.56)Every new Git command of the last year in one place, with examples: git history, git last-modified, git repo, the git refs family, config-based and parallel hooks, git add --resolved, git branch --delete-merged, bisect auto-reset, and how to prepare for Git 3.0 with main, reftable and SHA-256.intermediate9 min readCompleted

↑ ↓ navigate Enter open Esc close