Git and Branching¶
Git is the front door to modern delivery. A push triggers CI, a merge deploys through GitOps, and a revert is often the fastest rollback you have. This track builds a mental model of how Git stores history, so commands stop feeling like magic, and then covers the workflows and recovery skills teams rely on.
What You'll Learn¶
- How commits, trees, blobs, branches, and
HEADactually work - A clean daily workflow with rebasing, pushing, and pull requests
- How to choose a branching strategy that fits your delivery model
- How to undo almost anything — and recover "lost" work with the reflog
- How to keep repositories healthy: commit conventions, hooks, protected branches, and secrets
Read in This Order¶
- How Git Works — objects, the staging area, refs,
HEAD, and what a branch really is - Everyday Workflow — configuration, branching, committing, rebasing vs merging, and pushing safely
- Branching Strategies — trunk-based development, GitHub flow, GitFlow, release branches, and merge methods
- Undo and Recovery —
restore,reset,revert,reflog,cherry-pick,stash, andbisect - Collaboration and Repository Hygiene — commit messages, signed commits, pre-commit hooks, rulesets, large files, and leaked secrets
Commands by Situation¶
| I want to… | Command |
|---|---|
| See what changed | git status, git diff, git diff --staged |
| Start new work | git switch -c feature/login main |
| Update my branch with main | git fetch && git rebase origin/main |
| Undo uncommitted changes to a file | git restore path/to/file |
| Fix the last commit | git commit --amend |
| Undo a pushed commit | git revert <sha> |
| Find a lost commit | git reflog |
| Find which commit broke something | git bisect |
How Git Connects to the Rest of the Site¶
- CI/CD Pipelines run on pushes and pull requests.
- ArgoCD and GitOps deploy whatever is committed to a config repository.
- Terraform in CI plans on pull requests and applies on merge.
Next¶
Start with How Git Works.