Git Course Outline: From First Commit to Git Internals
A complete Git course for students and working developers: commits, diffs and history, branching, merging and rebasing, remotes and teamwork, undoing and recovery, investigation tools, configuration, releases, large projects, internals and graded exercises.
kvi5hnuCode Sprout team member8 min readOn this page
This course teaches Git from your first commit to the techniques experienced developers rely on: interactive rebase, recovering "lost" work, bisecting a bug, rewriting history safely, and understanding what Git stores on disk. It's written for two kinds of reader:
- Students and beginners who have never used version control. Part 1 starts from what version control is, and every article builds only on the ones before it.
- Working developers who use Git every day but want to stop being afraid of it: to understand why commands behave as they do, fix mistakes confidently, and prepare for interviews. Each article has a "Common questions" section for the doubts people really have, and the delicate details are tested in the quizzes.
How the course works
- Current Git. Everything is checked against Git 2.56, the latest release, with notes on what changed recently and what Git 3.0 will change. Older forms you'll still meet in guides and scripts, such as
git checkoutfor switching branches, are explained alongside the modern ones. - Runnable examples. Most examples are shell scripts that run real Git in the page, in a fresh sandbox each time, with the output shown below them. The sandbox has the identity
Sam Lee <sam@example.com>, a fixed clock (so commit IDs come out the same every run),mainas the default branch, and no network: "remote" repositories are folders on the same machine. Run them in any order, change them, and run them again. - One example project. Most examples use a small project called
trail-guide, a guide to hiking trails with a README and some trail notes, worked on by Sam, Ana, Ravi and Mei, so you can focus on Git instead of the files. - Practice at every step. Every article ends with practice questions and answers, Parts 1 to 12 each end with a review quiz, Part 13 is a set of graded exercises, and three final quizzes test the whole course.
You'll need a terminal. Article 2 covers installing Git on Windows, macOS and Linux. Git commands work the same in every terminal. The examples' helper commands, such as echo, cat and sed, are standard bash, so they run as-is in Git Bash on Windows and in macOS and Linux terminals.
What you'll learn
| Part | Topic | What it covers | Articles |
|---|---|---|---|
| 1 | Getting started | What version control and Git are, installing and configuring Git, your first repository, and the three areas every Git command works with. | 1–4 |
| 2 | Everyday work | The daily loop: staging, committing with good messages, reading diffs, ignoring files, and finding anything in the history. | 5–10 |
| 3 | Branching and merging | Branches as pointers, fast-forward and three-way merges, resolving conflicts, rebasing, interactive rebase and cherry-picking. | 11–16 |
| 4 | Remotes and collaboration | Working with other people: remotes, cloning, fetching and pulling, pushing safely, authentication, team workflows and branch cleanup. | 17–23 |
| 5 | Undoing and recovering | Getting out of trouble: restore, reset and revert, undoing merges, recovering lost work with the reflog, stashing and cleaning. | 24–28 |
| 6 | Investigating history | Naming any commit, finding who changed a line, hunting down the commit that broke something, and searching and measuring a repository. | 29–32 |
| 7 | Configuration and customization | Making Git yours: configuration levels and useful defaults, aliases, line endings and attributes, hooks, and tools around Git. | 33–37 |
| 8 | Tags, releases and signing | Marking releases with tags, describing versions, building archives, and signing commits and tags. | 38–39 |
| 9 | Larger projects | Several checkouts at once, repositories inside repositories, large files, and techniques for very large repositories. | 40–44 |
| 10 | Patches, bundles and rewriting history | Sharing changes as patches and bundles, and rewriting history safely to fix authors or remove secrets and big files. | 45–47 |
| 11 | Git internals | How Git really works: objects, refs and plumbing, packfiles and garbage collection, SHA-256, reftable and what Git 3.0 changes. | 48–50 |
| 12 | Professional practice | Moving other version control systems to Git, the habits of experienced teams, and a troubleshooting guide for common problems. | 51–53 |
| 13 | Exercises | Graded hands-on exercise sets with explained solutions, from first commits to advanced history surgery. | 54–56 |
Part 1: Getting started
What version control and Git are, installing and configuring Git, your first repository, and the three areas every Git command works with.
- What Git Is: Version Control, Snapshots and Distributed Repositories
- Installing Git and First-Time Setup: Identity, Editor, Default Branch and Help
- Your First Git Repository: init, add, commit, status and log
- The Three Areas of Git: Working Tree, Staging Area and Repository
Part 2: Everyday work
The daily loop: staging, committing with good messages, reading diffs, ignoring files, and finding anything in the history.
- Staging Changes: add, Patch Mode, Interactive Staging, rm, mv and Unstaging
- Committing: Good Messages, Amending, Empty Commits, Authors and Dates
- Viewing Changes With git diff: Unstaged, Staged, Commits, Branches and Word Diffs
- Ignoring Files: .gitignore Patterns, Global and Local Ignores, and Untracking Files
- Browsing History With git log: Formatting, Graphs, Filtering and Searching
- Inspecting Commits and Files: git show, diff-tree and Files at Any Revision
Part 3: Branching and merging
Branches as pointers, fast-forward and three-way merges, resolving conflicts, rebasing, interactive rebase and cherry-picking.
- Git Branches: Creating, Switching, Listing, Renaming and Deleting
- Merging Branches: Fast-Forward, Three-Way Merges, --no-ff and Squash Merges
- Resolving Merge Conflicts: Conflict Markers, ours and theirs, Merge Tools and rerere
- Rebasing: Replaying Commits for a Linear History
- Interactive Rebase: Squash, Fixup, Reword, Reorder, Edit and Autosquash
- Cherry-Picking Commits and Finding What's Missing Between Branches
Part 4: Remotes and collaboration
Working with other people: remotes, cloning, fetching and pulling, pushing safely, authentication, team workflows and branch cleanup.
- Remote Repositories: add, rename, remove, set-url, show and ls-remote
- Cloning Repositories: Branches, Shallow, Partial and Sparse Clones
- Fetching and Pulling: Remote-Tracking Branches, Merge or Rebase, and Divergent Branches
- Pushing: Upstream Branches, push.default, Force-With-Lease, Deleting and Refspecs
- Connecting to Remotes: HTTPS Tokens, Credential Helpers, SSH Keys and Proxies
- Git Workflows: Feature Branches, Pull Requests, GitHub Flow, Gitflow, Forking and Trunk-Based
- Tidying Up: Pruning Remote-Tracking Branches and Deleting Merged and Gone Branches
Part 5: Undoing and recovering
Getting out of trouble: restore, reset and revert, undoing merges, recovering lost work with the reflog, stashing and cleaning.
- Undoing Changes: restore, reset, revert and Detached HEAD
- Undoing Merges: Aborting, Resetting and Reverting a Merge Commit
- Recovering Lost Work With the Reflog: Commits, Branches, Rebases and Stashes
- Stashing Work in Progress: push, pop, apply, Partial Stashes and Branches
- Removing Untracked Files With git clean
Part 6: Investigating history
Naming any commit, finding who changed a line, hunting down the commit that broke something, and searching and measuring a repository.
- Naming Commits: Revision Syntax, Ancestry, Ranges and Reflog References
- Who Changed This Line? git blame and Ignoring Noise Commits
- Finding the Commit That Broke Something With git bisect
- Searching and Statistics: git grep, shortlog, .mailmap and Repository Numbers
Part 7: Configuration and customization
Making Git yours: configuration levels and useful defaults, aliases, line endings and attributes, hooks, and tools around Git.
- Git Configuration: Levels, Conditional Includes, One-Off Settings and Useful Defaults
- Git Aliases: Shortcuts, Shell Aliases and a Useful Collection
- Line Endings and .gitattributes: autocrlf, eol, Binary Files and Diff Drivers
- Git Hooks: pre-commit, commit-msg, pre-push, Server-Side Hooks and Sharing Hooks
- Git Tooling: Shell Prompt and Completion, GUI Clients, and External Diff and Merge Tools
Part 8: Tags, releases and signing
Marking releases with tags, describing versions, building archives, and signing commits and tags.
- Tags and Releases: Lightweight and Annotated Tags, describe and archive
- Signing Commits and Tags With GPG or SSH Keys
Part 9: Larger projects
Several checkouts at once, repositories inside repositories, large files, and techniques for very large repositories.
- Worktrees: Several Branches Checked Out at Once
- Submodules: Repositories Inside Repositories
- Subtrees: Including Another Project's History
- Large Files: Git LFS and Keeping Binaries Out of History
- Large Repositories: Sparse Checkout, Partial Clone, Maintenance and Scalar
Part 10: Patches, bundles and rewriting history
Sharing changes as patches and bundles, and rewriting history safely to fix authors or remove secrets and big files.
- Patches: diff, format-patch, am, apply and send-email
- Bundles: Moving Commits Without a Network Connection
- Rewriting History: Authors, Dates, Secrets and Big Files With filter-repo
Part 11: Git internals
How Git really works: objects, refs and plumbing, packfiles and garbage collection, SHA-256, reftable and what Git 3.0 changes.
- Git Objects: Blobs, Trees, Commits and Tags
- Refs, HEAD and Plumbing Commands: Building a Commit by Hand
- How Git Stores Data: Packfiles, Garbage Collection, SHA-256, Reftable and Git 3.0
Part 12: Professional practice
Moving other version control systems to Git, the habits of experienced teams, and a troubleshooting guide for common problems.
- Migrating to Git From Subversion, TFVC and Mercurial
- Git Best Practices: Commits, Branches, Reviews and Repository Hygiene
- Fixing Common Git Problems: A Troubleshooting Guide
Part 13: Exercises
Graded hands-on exercise sets with explained solutions, from first commits to advanced history surgery.
- Git Exercises With Solutions: Beginner
- Git Exercises With Solutions: Intermediate
- Git Exercises With Solutions: Advanced
After the course: final quizzes
Start here: What Git Is: Version Control, Snapshots and Distributed Repositories

More in Git Course
Quiz: Git Delicate Details
Twenty-five questions on Git's subtle corners: what commit -a and stash leave out, empty folders, ignore patterns and negation, HEAD~ versus HEAD^, ours and theirs in a rebase, tags that don't move or don't push, describe, merge reverts, diff exit codes, stash conflicts and more.
Quiz: Git Interview Questions
Thirty Git questions of the kind asked in developer interviews: Git versus GitHub, the staging area, merge versus rebase, fetch versus pull, reset, revert and restore, detached HEAD, conflicts, force pushing, stash, cherry-pick, reflog, bisect, submodules, LFS and how commits are identified.
Quiz: Git Course Final Exam (All Parts)
The final exam for the Git course: thirty questions across all twelve parts, from the three areas and staging through branching, remotes, undoing, history investigation, configuration, tags, larger projects, patches, rewriting, internals and troubleshooting.
Quiz: Professional Git Practice (Git Part 12)
Sixteen questions on migrating to Git from Subversion, TFVC and Mercurial, team best practices for commits, branches and reviews, repository hygiene, and diagnosing and fixing the most common Git errors, with explanations.
Discussion
Sign in to ask a question or share what you learned.