Git scenario interview questions
Git questions in DevOps interviews are about shared history and how code reaches production, not memorizing commands. What happens to everyone else when main is rewritten, and why is git pull on a server a weak deploy process?
Each question below is the exact prompt from a DevOps Ledger challenge. Decide what you would do, then open the challenge to defend it.
5 scenarios: 4 beginner, 1 intermediate, 0 advanced. Answer keys reviewed by Branko Petric.
What interviewers probe
- Rewriting shared history and how to recover from it
- Repeatable deploys built from artifacts
- What removing a secret from history does and does not fix
The questions
- 01beginner8 min
You Pushed AWS Keys to a Public Repo
You just pushed a commit to a public GitHub repo that contains your AWS access keys. You notice five minutes later. A teammate says just delete the file and force-push. What do you do first, and why?
Practice this scenario - 02beginner9 min
Deploys Are SSH + git pull at 5pm Friday. Why Change It?
Your team deploys by SSHing into the prod server and running git pull, and the current release is planned for 5pm on Friday. A teammate says this has worked for two years, so why change anything? What do you argue, and why?
Practice this scenario - 03beginner8 min
History Is Messy, So Force-Push a Clean main?
A bad merge left three ugly merge commits and a reverted-then-unreverted change on main. A teammate wants to rebase main locally to clean it up and git push --force to overwrite the shared history. What do you do, and why?
Practice this scenario - 04beginner10 min
Commit terraform.tfstate to the Repo So Everyone Shares It?
Two engineers ran terraform apply from their laptops and got conflicting results. A teammate proposes committing terraform.tfstate to the git repo so everyone shares the same state. Do you agree, and what do you do instead?
Practice this scenario - 05intermediate12 min
A GitHub Action You Use Was Hijacked. Bump the Tag and Move On?
A popular third-party scanner action had its version tags moved to a malicious commit for about twelve hours. Your org references it as @v2 in around 40 repos, and scheduled jobs ran during that window. A teammate opened PRs bumping to the maintainer's new safe tag and wants to close the ticket because the logs look normal. Do you agree, and what do you do?
Practice this scenario
Worked answers
- Scenario Based DevOps Interview Questions, With Worked Answers
Scenario based DevOps interview questions for Linux, Docker, CI/CD, Git and AWS, with first commands, the interviewer's pushback, and weak vs strong answers.
Practice defending your decisions
DevOps Ledger is a scenario-based DevOps and SRE interview practice platform: you pick a real production incident, defend your decision in a chat against a senior-engineer AI that pushes back, and get scored against an answer key written before you started.
A general chatbot makes up an answer on the spot. DevOps Ledger grades you against an answer key written before you started.
One payment. 12 months of access. No subscription, nothing renews.
Get full access - $19