INTERVIEW PREP
Interview questions
570 questions from real DevOps, SRE, platform engineering and MLOps interviews, with the answer an interviewer wants to hear. Try answering out loud first, then open the model answer.
Showing 16–20 of 20 questions
Learn Git →16.How do you recover a branch you deleted by mistake?Senior
git reflog shows where HEAD has been; find the last commit of the branch and run git branch name <sha>. Commits stay recoverable until garbage collection prunes them.
17.How do you handle a huge repository that is slow to clone?Senior
Use shallow clones (--depth 1) in CI, partial clones (--filter=blob:none) and sparse checkout for monorepos. Move large binaries to Git LFS or an artifact store, and clean old large files out of history with git filter-repo if needed.
18.What is trunk-based development, and what does it need to work?Senior
Everyone merges small changes into main at least daily instead of keeping long-lived branches. It needs fast CI, good automated tests, feature flags to hide unfinished work, and code review that happens quickly.
19.How do you protect the main branch?Senior
Use branch protection: no direct pushes, required pull request reviews (and CODEOWNERS), required passing CI checks, signed commits if needed, and no force pushes. Combine with secret scanning on push.
20.How does Git store data internally?Senior
Git is a content-addressed store of objects: blobs (file content), trees (folders), commits (a tree plus parents and metadata) and tags. Each object is named by its hash. Branches are just files that point to a commit hash.