Git and GitHub Guide: Commits, Branches, Pull Requests
Git feels confusing until you see what it stores: snapshots and pointers. This guide starts with that mental model, then builds up the daily commands, branching, pull requests and the safe ways to undo mistakes.
Every command was run in a throwaway repository, and the real output is shown.
Who it is for: Developers who use Git every day but still feel unsure about merges, rebases or recovering lost work.
9 lessons · Published by Jainik · Last updated
1. The mental model and the daily loop
- 1. Git & GitHub · 7 minThe Mental Model: Snapshots, Commits and Branches
The working tree, the staging area and the repository, how a commit is a snapshot with a parent, and how branches and HEAD are just pointers.
- 2. Git & GitHub · 9 minThe Daily Loop: Status, Add, Commit, Diff and Log
The commands you use every day, .gitignore, good commit messages and staging parts of a file with git add -p.
2. Branches, remotes and pull requests
- 3. Git & GitHub · 8 minBranches, Merging and Conflicts
Fast-forward versus merge commits, and a real merge conflict resolved step by step.
- 4. Git & GitHub · 9 minRemotes, Pull Requests and Code Review
Remotes, fetch versus pull, upstream tracking, forks, and the pull request flow with review habits.
- 5. Team Lead Mindset · 15 minEstimates, Code Review and Priorities
Honest ranges with named unknowns, missed deadlines, quick fix versus proper fix, reviewing for better-not-perfect, and saying no with an option.
3. Undoing things and clean history
- 6. Git & GitHub · 10 minUndoing Things Safely: Restore, Reset, Revert, Reflog and Friends
The undo tools run for real, recovering a lost commit with reflog, bisect, and a table of which command to use.
- 7. Git & GitHub · 11 minRebase, Clean History and Team Workflows
Rebase versus merge, tidying history, force-with-lease, branch protection, CODEOWNERS and a first GitHub Actions workflow.
4. Team workflow and automation
- 8. Full-Stack Questions · 30 minGit, Team Workflow and Monorepos
Merge vs rebase, undoing mistakes, reflog, bisect, branching models, code review, pnpm workspaces, Turborepo, changesets and versioning.
- 9. DevOps · 22 minCI/CD with GitHub Actions
Lint, test, build and deploy on every push — automatically, with no one SSH-ing into a server.
More reading orders are on the guides page, and every series is listed on the home page.