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: 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
- Practice: every exercise and quiz (25 exercises, 34 quizzes)
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.
- 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.
- What version control is and why Git won Free lesson, Pro answers: 20 minutes
- Install Git and set up your identity Free lesson, Pro answers: 25 minutes
- Your first repository: init, add and commit Free lesson, Pro answers: 25 minutes
- Module 2
Recording changes
Staging exactly what you mean, writing reviewable commits and messages, and ignoring files correctly.
- Stage exactly what you mean with git add -p Free lesson, Pro answers: 25 minutes
- Write commits that are easy to review Free lesson, Pro answers: 20 minutes
- Ignore files with .gitignore Free lesson, Pro answers: 20 minutes
- 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.
- Read history with git log, show and diff Free lesson, Pro answers: 30 minutes
- Find when a bug appeared: blame, log -S and bisect Free lesson, Pro answers: 35 minutes
- Module 4
Branching and merging
Branches as pointers, HEAD and git switch, fast-forward and three-way merges, and resolving conflicts with confidence.
- Branches, HEAD and git switch Free lesson, Pro answers: 25 minutes
- Merge branches: fast-forward and three-way Free lesson, Pro answers: 25 minutes
- 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.
- Set up GitHub: account, 2FA and SSH keys Free lesson, Pro answers: 20 minutes
- Remotes and cloning: origin and tracking branches Free lesson, Pro answers: 20 minutes
- Sync work with fetch, pull and push Free lesson, Pro answers: 20 minutes
- Forks: contribute where you cannot push Free lesson, Pro answers: 15 minutes
- 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.
- Open, update and merge a pull request Free lesson, Pro answers: 35 minutes
- Review pull requests and respond to feedback Free lesson, Pro answers: 40 minutes
- 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.
- Rebase a branch onto main Free lesson, Pro answers: 35 minutes
- Clean up commits with interactive rebase Free lesson, Pro answers: 40 minutes
- Cherry-pick and revert single commits Free lesson, Pro answers: 30 minutes
- Merge, rebase or squash: choose a strategy Free lesson, Pro answers: 25 minutes
- 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.
- Undo changes with restore, reset and amend Free lesson, Pro answers: 20 minutes
- Park unfinished work with stash and worktrees Free lesson, Pro answers: 20 minutes
- Recover lost commits with the reflog Free lesson, Pro answers: 20 minutes
- 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.
- Tags, versions and GitHub Releases Free lesson, Pro answers: 25 minutes
- Sign commits and tags with SSH or GPG Free lesson, Pro answers: 30 minutes
- Leaked a secret? Revoke it, then clean history Free lesson, Pro answers: 35 minutes
- Module 10
Git internals
Objects and hashes, references, the index and packfiles, and how Git computes diffs and merges.
- Git objects: blobs, trees, commits and tags Free lesson, Pro answers: 35 minutes
- Refs, the index and packfiles Free lesson, Pro answers: 35 minutes
- How Git computes diffs and merges Free lesson, Pro answers: 30 minutes
- Module 11
Customising and scaling Git
Line endings and .gitattributes, large files and big repositories, and code from other repositories with submodules and subtrees.
- Submodules and subtrees: code from other repos Free lesson, Pro answers: 30 minutes
- Module 12
Hooks and CI
Automating checks with Git hooks and configuration-based hooks, and running tests on every push with GitHub Actions safely.
- Automate checks with Git hooks Free lesson, Pro answers: 25 minutes
- Run tests on every push with GitHub Actions Free lesson, Pro answers: 25 minutes
- 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.
- Team workflows: GitHub flow, trunk-based, Git flow Free lesson, Pro answers: 25 minutes
- Set up a repository for collaborators Free lesson, Pro answers: 35 minutes
Related tools
Official documentation
- Git reference documentation (Git)
- Git documentation (book, videos and guides) (Git)
- GitHub Docs (GitHub)
- GitHub CLI manual (GitHub)