Git & GitHub Tutorial with Examples.
Git tutorial: version control fundamentals, branching, rebasing, merge strategies, cherry-pick, hooks and GitHub workflows.
Beginner
Start here — no prior experience needed
Git Basics: Init, Add, Commit, Diff
Learn Git's core snapshot workflow with real command output: git init, add, status, commit, log, and diff on a tiny Python project.
Branching, Merging, and Real Conflicts
Create branches, fast-forward merge one, force a real three-way merge conflict with another, and resolve it — all with actual git output.
Undoing Changes: restore, reset, and revert
See the real difference between git restore, the three reset modes, and git revert — including which ones rewrite history and which ones don't.
Stashing Work in Progress
Shelve an unfinished edit and an untracked file with git stash, make an unrelated commit on a clean tree, then reapply the stash with a real auto-merge.
Remotes: Fetch, Pull, Push, and Tracking Branches
Push to a real shared remote, have a second clone push a commit, then fetch and pull to see exactly what a tracking branch reports before and after merging.
Ignoring Files with .gitignore
Watch .gitignore actually hide matching files from git status, see it fail to hide a file already tracked, and debug pattern matches with git check-ignore.
Intermediate
For developers with core concepts down
PR Workflow: Rebasing, Squash Merge, and Merge Commits
Sync a feature branch with rebase instead of merge, then compare squash-merge and --no-ff merge-commit history side by side with real git log output.
Rewriting History: Amend and Interactive Rebase
Fix a commit message and fold in a forgotten file with git commit --amend, then squash three sloppy WIP commits into one clean commit with interactive rebase.
Recovering Lost Commits with Reflog
Accidentally discard a commit with git reset --hard, watch it vanish from git log, then find and recover it with git reflog.
Finding the Bad Commit with git bisect
Use git bisect run with a real automated test script to binary-search five commits and pinpoint the exact one that silently broke a function.
Cherry-picking a Hotfix and Tagging a Release
Port a single commit from an older branch onto main with git cherry-pick, then mark the result with a real annotated tag and inspect it.
Advanced
Production-grade patterns for experienced engineers
Also part of Git & GitHub
Taught in other topics. Each link opens the lesson in its home topic.