CS FundamentalsHardProduct-company DevOps interview
A team lead adds a pre-commit hook to .git/hooks/pre-commit in her repository and pushes. Teammates who clone the repository report that the hook never runs. What is the explanation?
- A. Hooks run only on the server
- B. The .git/hooks folder is not part of the versioned content, so clones do not get it; the team should version a hooks folder (e.g. via core.hooksPath or a hook manager) and also enforce the checks in CI
- C. Hooks must be written in Python
- D. The hook runs only after git push
Correct answer: B. The .git/hooks folder is not part of the versioned content, so clones do not get it; the team should version a hooks folder (e.g. via core.hooksPath or a hook manager) and also enforce the checks in CI
Client-side hooks live in .git, which is never pushed or cloned. Sharing them needs a versioned script folder plus setup; and because hooks can be skipped with --no-verify, CI must enforce the same checks.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- After rebasing your branch you must update the remote branch. A colleague may have pushed to the same branch meanwhile. Why prefer git…
- You create an annotated tag v2.0 locally and run git push. The tag does not appear on the remote. What is correct?
- A file config.env holding a live API key was committed and pushed three weeks ago. The developer now runs git rm --cached config.env, adds…
- How many of these statements about Git's object model are correct? 1. Two files with identical content in different folders are stored as…
- You pushed commit C to a shared branch, then ran git commit --amend to fix its message and tried git push again. What happens and why?
- main has A-B-X, where X was committed after feature branched from B; feature has C-D-E. How many commits are reachable from main after…