Intermediate
Git & Version Control
Q66 / 100
What is the purpose of a "pre-commit hook" in Git?
Correct! Well done.
Incorrect.
The correct answer is A) A script stored in ".git/hooks/" that runs automatically before a commit is finalized, often used to run linters, tests, or formatting checks, and can abort the commit if it fails
A
Correct Answer
A script stored in ".git/hooks/" that runs automatically before a commit is finalized, often used to run linters, tests, or formatting checks, and can abort the commit if it fails
Explanation
Git hooks are local scripts triggered by specific Git events; a pre-commit hook can enforce code quality standards by running checks and preventing the commit if they fail, though hooks themselves are not version-controlled by default (tools like Husky help manage this).
Progress
66/100