All jobs / Frontend / web developer / Tooling
Frontend / web developer interview question · 0–1 years
How do you commit a CSS fix that accidentally includes a .env file in the working tree?
The strongest answer
Leave the secret out of the commit, add .env to gitignore, and rotate the key if it was ever committed
Why it works
Secrets do not belong in git. Unstage, ignore, rotate if they leaked.
What a good answer covers
- Never commit secrets.
- Unstage .env; gitignore it.
- Commit only the CSS.
- If it was pushed, rotate the key — history rewrite is not enough.
Answers that fall short
- Close, but not the strongest: Commit everything, then amend later when I remember
Amend is fine only on an unpushed local commit — still don't put the secret in history even briefly if you can avoid it. - Weak: Commit the .env so teammates share the same config
Shared secrets in git are how keys leak in forks and clones. - Red flag: Force-push a history rewrite on the shared branch and leave the key live
Rewriting shared history without a rotation leaves the key in clones.
Who gets asked this
More Tooling questions
- Your new team uses both ESLint and Prettier. What does each one do, and why have both?
- You need to ship a small button-style change. How do you use git?
- CI installed different package versions than your laptop. Strongest fix?
- How do you use DevTools to find out where it fails?
- You need an API base URL in a Vite app without leaking a private key. What do you do?
- Fast Refresh resets a component's state on every edit. What usually caused it?
- A half-rolled feature is erroring in production. Strongest frontend move?
- What does a bundler such as Webpack or Vite’s production build actually do for you, and what breaks tree…