Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

DevOps and cloud

Git & GitHub

Git and GitHub from a first commit to rebase, recovery, internals and Actions, with every example run in real Git and its output shown.

34 lessons to read 13 modules

34 lessons: 34 free with Pro answers.

Examples run with git 2.54.0.

Who it is for

Every developer; students starting projects and first open-source contributions.

What you will be able to do

  • Use the three trees (working tree, index, HEAD) to predict what any common Git command will do
  • Branch, merge, rebase and resolve conflicts with confidence, choosing a strategy that suits the team
  • Collaborate on GitHub securely: SSH or token access, pull requests, reviews, forks and protected branches
  • Undo and recover anything that was committed, using restore, reset, revert, stash, the reflog and fsck
  • Investigate history with log, blame, pickaxe search and bisect to find when and why code changed
  • Explain how Git stores objects, references and packs, and build a commit with plumbing commands
  • Ship releases with tags, SemVer, signed commits and a hardened GitHub Actions workflow
  • Respond correctly to a leaked secret and prevent the next one
  • Make a first open-source contribution that maintainers welcome

Revise and practise

Modules and lessons

What the labels mean

Free lesson, Pro answers
the whole lesson is free; the model answers to its interview questions open with a pass
Pro
opens with a Pro, Premium or Ultimate pass

Minutes are reading time.

What a pass opens in this track

70 interview answers. The same pass opens every other track and every Pro tool.

  1. Module 1

    Getting started with Git

    What version control is, Git versus GitHub, installing and configuring Git, and a first repository built commit by commit.

    1. What version control is and why Git won Beginner Free lesson, Pro answers: 20 minutes
    2. Install Git and set up your identity Beginner Free lesson, Pro answers: 25 minutes
    3. Your first repository: init, add and commit Beginner Free lesson, Pro answers: 25 minutes
  2. Module 2

    Recording changes

    Staging exactly what you mean, writing reviewable commits and messages, and ignoring files correctly.

    1. Stage exactly what you mean with git add -p Beginner Free lesson, Pro answers: 25 minutes
    2. Write commits that are easy to review Beginner Free lesson, Pro answers: 20 minutes
    3. Ignore files with .gitignore Beginner Free lesson, Pro answers: 20 minutes
  3. Module 3

    Exploring history

    Reading history with log, show and diff, naming commits and ranges, and finding when and why a line changed with blame, pickaxe and bisect.

    1. Read history with git log, show and diff Beginner Free lesson, Pro answers: 30 minutes
    2. Find when a bug appeared: blame, log -S and bisect Intermediate Free lesson, Pro answers: 35 minutes
  4. Module 4

    Branching and merging

    Branches as pointers, HEAD and git switch, fast-forward and three-way merges, and resolving conflicts with confidence.

    1. Branches, HEAD and git switch Beginner Free lesson, Pro answers: 25 minutes
    2. Merge branches: fast-forward and three-way Beginner Free lesson, Pro answers: 25 minutes
  5. Module 5

    GitHub and remotes

    Setting up a secure GitHub account, cloning and connecting remotes, syncing with fetch, pull and push, and working with forks.

    1. Set up GitHub: account, 2FA and SSH keys Beginner Free lesson, Pro answers: 20 minutes
    2. Remotes and cloning: origin and tracking branches Beginner Free lesson, Pro answers: 20 minutes
    3. Sync work with fetch, pull and push Intermediate Free lesson, Pro answers: 20 minutes
    4. Forks: contribute where you cannot push Intermediate Free lesson, Pro answers: 15 minutes
  6. Module 6

    Pull requests and code review

    Opening, updating and merging pull requests, linking issues, and reviewing code well on both sides of the review.

    1. Open, update and merge a pull request Beginner Free lesson, Pro answers: 35 minutes
    2. Review pull requests and respond to feedback Intermediate Free lesson, Pro answers: 40 minutes
  7. Module 7

    Rebase, cherry-pick and revert

    Replaying commits with rebase, cleaning series with interactive rebase, copying and undoing single commits, and choosing an integration strategy.

    1. Rebase a branch onto main Intermediate Free lesson, Pro answers: 35 minutes
    2. Clean up commits with interactive rebase Advanced Free lesson, Pro answers: 40 minutes
    3. Cherry-pick and revert single commits Intermediate Free lesson, Pro answers: 30 minutes
    4. Merge, rebase or squash: choose a strategy Intermediate Free lesson, Pro answers: 25 minutes
  8. Module 8

    Undoing and recovering

    Undoing uncommitted and committed work with restore, reset and amend, parking work with stash and worktrees, and recovering lost commits.

    1. Undo changes with restore, reset and amend Intermediate Free lesson, Pro answers: 20 minutes
    2. Park unfinished work with stash and worktrees Intermediate Free lesson, Pro answers: 20 minutes
    3. Recover lost commits with the reflog Intermediate Free lesson, Pro answers: 20 minutes
  9. Module 9

    Releases, signing and security

    Tags and Semantic Versioning, GitHub Releases, signing commits with SSH or GPG, and responding correctly when a secret is committed.

    1. Tags, versions and GitHub Releases Beginner Free lesson, Pro answers: 25 minutes
    2. Sign commits and tags with SSH or GPG Advanced Free lesson, Pro answers: 30 minutes
    3. Leaked a secret? Revoke it, then clean history Advanced Free lesson, Pro answers: 35 minutes
  10. Module 10

    Git internals

    Objects and hashes, references, the index and packfiles, and how Git computes diffs and merges.

    1. Git objects: blobs, trees, commits and tags Advanced Free lesson, Pro answers: 35 minutes
    2. Refs, the index and packfiles Advanced Free lesson, Pro answers: 35 minutes
    3. How Git computes diffs and merges Advanced Free lesson, Pro answers: 30 minutes
  11. Module 11

    Customising and scaling Git

    Line endings and .gitattributes, large files and big repositories, and code from other repositories with submodules and subtrees.

    1. Submodules and subtrees: code from other repos Advanced Free lesson, Pro answers: 30 minutes
  12. Module 12

    Hooks and CI

    Automating checks with Git hooks and configuration-based hooks, and running tests on every push with GitHub Actions safely.

    1. Automate checks with Git hooks Intermediate Free lesson, Pro answers: 25 minutes
    2. Run tests on every push with GitHub Actions Intermediate Free lesson, Pro answers: 25 minutes
  13. Module 13

    Teamwork and open source

    Team branching workflows, setting up a repository for collaborators, a first open-source contribution, and scenario and interview practice.

    1. Team workflows: GitHub flow, trunk-based, Git flow Intermediate Free lesson, Pro answers: 25 minutes
    2. Set up a repository for collaborators Intermediate Free lesson, Pro answers: 35 minutes

Related tools

Official documentation

More in DevOps and cloud

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.