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 1–8 of 8 questions
Learn Git →1.You committed a secret and pushed it. What do you do?Mid
Rotate the secret first, because it is already compromised. Then remove it from history (git filter-repo or BFG), force-push, ask collaborators to re-clone, and add secret scanning to prevent a repeat.
2.How do you undo a commit that is already on main?Mid
git revert <sha> creates a new commit that undoes it, which is safe on shared branches. reset --hard rewrites history and should only be used on private branches.
3.How do you find which commit introduced a bug?Mid
git bisect start, mark a bad and a good commit, and test each midpoint Git checks out; git bisect run ./test.sh automates it. It finds the culprit in log2(n) steps.
4.How do you resolve a merge conflict?Mid
Git marks the conflicting lines with <<<<<<<, ======= and >>>>>>>. Edit the file to the correct final version, remove the markers, git add it, then git commit (or git rebase --continue). Run the tests before pushing.
5.What does git stash do?Mid
It saves your uncommitted changes and gives you a clean working directory, so you can switch branches. git stash pop brings them back; git stash list shows saved stashes.
6.How do you squash several commits into one?Mid
Use an interactive rebase: git rebase -i HEAD~4 and mark commits as squash or fixup. Many teams use 'squash and merge' in the pull request instead. Only rewrite commits that aren't shared yet.
7.What is git cherry-pick and when is it useful?Mid
It copies one commit onto your current branch, for example to bring a hotfix from main into a release branch. Use it for a few commits; for many, merge or rebase instead.
8.What are Git hooks?Mid
Scripts Git runs at certain moments, such as pre-commit or commit-msg. Teams use them (often through the pre-commit framework) to run linters, formatters and secret scanners before code leaves a laptop. Enforce the same checks in CI too, because local hooks can be skipped.