Junior / Associate DevOps [L1]
Branching, Merging & Conflicts
⚡ Scenario git-q001-you-started-coding-directly-on-main
A branch in Git is just a pointer to a commit, so "moving" commits is really just moving pointers around....
Junior / Associate DevOps [L1]
Branching, Merging & Conflicts
⚡ Scenario git-q002-what-is-the-difference-between-git-
git clone is a Git command — git fork is not a Git command, it's a GitHub/GitLab feature....
Senior DevOps / SRE [L2]
Branching, Merging & Conflicts
⚡ Scenario git-q003-you-ran-git-merge-and-git-stopped-w
Git stopped because it couldn't auto-merge — both branches changed the same lines....
Senior DevOps / SRE [L2]
Branching, Merging & Conflicts
⚡ Scenario git-q004-when-should-you-use-git-rebase-inst
Both integrate changes from one branch into another, but they produce very different histories....
Junior / Associate DevOps [L1]
Undo, Recovery & History Rewriting
⚡ Scenario git-q005-you-have-local-changes-in-your-work
Different commands for different states — and one of them is destructive, so know which:...
Junior / Associate DevOps [L1]
Undo, Recovery & History Rewriting
⚡ Scenario git-q006-you-added-configyaml-to-gitignore-b
.gitignore only prevents new files from being tracked. It does not untrack files that are already in the repo. Git is still watching conf......
Junior / Associate DevOps [L1]
Undo, Recovery & History Rewriting
⚡ Scenario git-q007-youre-in-detached-head-state-what-d
Normally HEAD points to a branch (e.g. main), and the branch points to a commit. "Detached HEAD" means HEAD points directly at a commit w......
Senior DevOps / SRE [L2]
Undo, Recovery & History Rewriting
⚡ Scenario git-q008-you-ran-git-push-force-to-your-feat
The commit isn't lost on the remote yet — it's still in the remote's reflog and likely in your teammate's local repo. Recovery:...
Senior DevOps / SRE [L2]
Undo, Recovery & History Rewriting
⚡ Scenario git-q009-you-merged-a-pr-into-main-that-turn
You can't reset main — it's shared and 15 other commits have built on top. The right tool is git revert, which creates a new commit that ......
Senior DevOps / SRE [L2]
Undo, Recovery & History Rewriting
⚡ Scenario git-q010-you-have-eight-messy-wip-fix-typo-m
Use interactive rebase. Pick a base (usually where your branch diverged from main):...
Staff SRE / Principal Architect [L3]
Undo, Recovery & History Rewriting
⚡ Scenario git-q011-a-junior-engineer-ran-git-reset-har
A --hard reset moves the branch pointer and discards working-tree changes — but the commits themselves are not deleted. They're orphaned ......
Junior / Associate DevOps [L1]
Collaboration & Remote Workflows
⚡ Scenario git-q012-in-one-paragraph-what-does-git-pull
git pull is two commands stitched together: git fetch (download new commits and tags from the remote into origin/<branch>) followed by gi......
Junior / Associate DevOps [L1]
Collaboration & Remote Workflows
⚡ Scenario git-q013-explain-the-four-states-a-file-can-
A file moves through these states:...
Senior DevOps / SRE [L2]
Collaboration & Remote Workflows
⚡ Scenario git-q014-a-critical-bug-fix-commit-exists-on
This is git cherry-pick:...
Senior DevOps / SRE [L2]
Collaboration & Remote Workflows
⚡ Scenario git-q015-production-is-broken-you-know-it-wo
Use git bisect — a binary search over commits....
Senior DevOps / SRE [L2]
Collaboration & Remote Workflows
⚡ Scenario git-q016-a-developer-accidentally-committed-
Treat the credential as compromised the moment it touches a public surface. Order matters:...
Staff SRE / Principal Architect [L3]
Advanced
⚡ Scenario git-q017-your-engineering-org-has-grown-to-5
Long-lived feature branches don't scale — the longer a branch lives, the more it diverges, and merges become expensive. The three viable ......
Staff SRE / Principal Architect [L3]
Advanced
⚡ Scenario git-q018-your-monorepo-has-grown-to-25-gb-an
Three orthogonal techniques solve three different problems:...
Staff SRE / Principal Architect [L3]
Advanced
⚡ Scenario git-q019-your-company-is-enforcing-supply-ch
By default, Git's Author and Committer headers are unauthenticated free-text — anyone can run git config user.email "ceo@company.com" and......
Staff SRE / Principal Architect [L3]
Advanced
⚡ Scenario git-q020-design-a-branch-protection-and-merg
Compliance auditors essentially want to see: every change to main is reviewed by someone other than the author, every change is traced to......
Junior / Associate DevOps [L1]
Stashing, Tags & Everyday Workflows
⚡ Scenario git-q021-youre-halfway-through-coding-a-feat
Use git stash to save your uncommitted changes onto a stack without committing them:...
Junior / Associate DevOps [L1]
... fix the bug, commit, push ...
⚡ Scenario git-q022-what-is-the-difference-between-a-li
Both point to a commit, but they're stored differently:...
Junior / Associate DevOps [L1]
... fix the bug, commit, push ...
⚡ Scenario git-q023-you-committed-with-the-wrong-messag
Use git commit --amend:...
Senior DevOps / SRE [L2]
... fix the bug, commit, push ...
⚡ Scenario git-q024-your-team-uses-git-submodules-to-in
git clone does not initialize submodules by default — it clones the parent repo and creates the submodule directory, but leaves it empty.......
Senior DevOps / SRE [L2]
... fix the bug, commit, push ...
⚡ Scenario git-q025-you-need-to-work-on-two-branches-of
Use git worktree to check out multiple branches simultaneously in separate directories, all backed by the same .git database:...
Senior DevOps / SRE [L2]
From your main checkout (on feature/new-api):
⚡ Scenario git-q026-your-team-wants-to-enforce-coding-s
Git hooks are scripts that run at specific points in the Git workflow. For pre-commit enforcement:...
Senior DevOps / SRE [L2]
From your main checkout (on feature/new-api):
⚡ Scenario git-q027-you-need-to-find-out-who-last-chang
Start with git blame:...
Senior DevOps / SRE [L2]
From your main checkout (on feature/new-api):
⚡ Scenario git-q028-you-maintain-a-shared-library-used-
git subtree embeds the contents of another repo directly into a subdirectory of your repo — no special .gitmodules file, no detached HEAD......
Junior / Associate DevOps [L1]
From your main checkout (on feature/new-api):
⚡ Scenario git-q029-what-does-git-fetch-do-vs-git-pull-
git fetch downloads new commits, branches, and tags from the remote into your local remote-tracking branches (e.g., origin/main) but does......
Senior DevOps / SRE [L2]
From your main checkout (on feature/new-api):
⚡ Scenario git-q030-your-ci-pipeline-has-a-job-that-nee
Use a shallow clone with --depth:...
Senior DevOps / SRE [L2]
From your main checkout (on feature/new-api):
⚡ Scenario git-q031-git-rerere-is-enabled-in-your-confi
rerere stands for "reuse recorded resolution." When enabled (git config --global rerere.enabled true), Git silently records how you resol......
Junior / Associate DevOps [L1]
From your main checkout (on feature/new-api):
⚡ Scenario git-q032-what-is-a-gitkeep-file-and-why-do-y
Git does not track empty directories. If you create logs/ with nothing in it and run git add logs/, nothing happens — Git has nothing to ......
Senior DevOps / SRE [L2]
.gitignore
⚡ Scenario git-q033-you-accidentally-committed-a-500-mb
Deleting a file in a new commit does not remove it from history. Git stores every version of every file as an immutable blob object. The ......
Staff SRE / Principal Architect [L3]
.gitignore
⚡ Scenario git-q034-you-need-to-deliver-a-git-repo-to-a
Use git bundle — it packages Git objects into a single file that can be copied via USB, email, or any file-transfer mechanism:...
Staff SRE / Principal Architect [L3]
Pull updates from an incremental bundle:
⚡ Scenario git-q035-explain-how-git-stores-data-interna
Git is fundamentally a content-addressable filesystem. Every piece of data is stored as an object identified by its SHA-1 (or SHA-256) ha......
Junior / Associate DevOps [L1]
Diffing, Logging & Code Archaeology
⚡ Scenario git-q036-whats-the-difference-between-git-di
Git has three important snapshots: the last commit (HEAD), the staging area (index), and the working directory. Each diff variant compare......
Junior / Associate DevOps [L1]
Diffing, Logging & Code Archaeology
⚡ Scenario git-q037-how-do-you-view-the-commit-history-
git log has many options to make history readable and filterable:...
Senior DevOps / SRE [L2]
Diffing, Logging & Code Archaeology
⚡ Scenario git-q038-you-want-to-generate-a-patch-file-f
Git has built-in support for email-style patch workflows (this is how the Linux kernel is developed):...
Senior DevOps / SRE [L2]
resolve conflicts, then:
⚡ Scenario git-q039-two-developers-merge-different-imag
Git can't merge binary files — there's no line-by-line diff. When both branches modify the same binary file, Git marks it as conflicted a......
Senior DevOps / SRE [L2]
resolve conflicts, then:
⚡ Scenario git-q040-your-company-has-multiple-git-remot
Git supports multiple remotes natively. Set them up:...
Senior DevOps / SRE [L2]
resolve conflicts, then:
⚡ Scenario git-q041-what-is-a-refspec-and-why-would-you
A refspec defines the mapping between remote refs and local refs. It's the rule Git follows when fetching or pushing to know which remote......
Junior / Associate DevOps [L1]
resolve conflicts, then:
⚡ Scenario git-q042-what-does-git-log-all-graph-oneline
This command shows a compact, visual representation of the entire commit history across all branches:...
Senior DevOps / SRE [L2]
resolve conflicts, then:
⚡ Scenario git-q043-what-is-mailmap-and-when-would-you-
.mailmap is a file that maps different author names and emails to a canonical identity. It fixes inconsistencies in git log, git shortlog......
Junior / Associate DevOps [L1]
🔶 Git Configuration & Optimization
⚡ Scenario git-q044-how-do-you-set-up-useful-git-aliase
Git aliases are shortcuts defined in your Git config:...
Senior DevOps / SRE [L2]
Amend without editing message
⚡ Scenario git-q045-what-does-git-gc-do-and-when-should
git gc (garbage collection) performs housekeeping on the Git object database:...
Senior DevOps / SRE [L2]
Amend without editing message
⚡ Scenario git-q046-what-is-git-fsck-and-when-would-you
git fsck (file system check) verifies the integrity of the Git object database — it walks every object and checks that nothing is corrupt......
Staff SRE / Principal Architect [L3]
Amend without editing message
⚡ Scenario git-q047-your-team-debates-whether-to-use-sq
Each strategy produces a different commit history shape with different tradeoffs:...
Staff SRE / Principal Architect [L3]
Amend without editing message
⚡ Scenario git-q048-youre-setting-up-a-git-server-for-a
Git supports four protocols for communication between client and server:...
Staff SRE / Principal Architect [L3]
Amend without editing message
⚡ Scenario git-q049-your-monorepo-ci-is-slow-because-ev
Use git diff to identify changed paths and map them to affected services:...
Staff SRE / Principal Architect [L3]
Determine affected services based on changed paths
⚡ Scenario git-q050-a-developer-reports-that-git-push-i
Slow pushes with small changesets typically aren't about bandwidth — the bottleneck is usually pack negotiation or server-side processing....