QuizzesGit Hooks — Automate with Every Git Action — Concept Check
intermediate
git

Git Hooks — Automate with Every Git Action — Concept Check

Questions on Git Hooks — Automate with Every Git Action. Git hooks are shell scripts that run automatically at key points in the Git workflow — before commits, before pushes, after merges. They enforce code quality, run tests, and prevent bad commits from ever entering the repository.

7 minutes 7 questions Pass at 70%
Time Limit
7 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

7 questions on Git Hooks — Automate with Every Git Action — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.You have set up a pre-commit hook to run ESLint on staged JavaScript files. What happens if ESLint finds issues?

    • AThe commit proceeds but a warning is logged.
    • BThe commit proceeds automatically after a delay.
    • CThe commit is rejected and an error message is displayed.
    • DThe commit is paused until issues are fixed manually.
  2. 2.A developer sets up a commit-msg hook to enforce Conventional Commits. What will happen if a commit message does not follow the format?

    • AThe commit is automatically reformatted.
    • BThe commit is rejected with an error message.
    • CThe commit is allowed but flagged for review.
    • DThe commit proceeds with a warning.
  3. 3.You notice that your pre-push hook is taking too long. What might be causing this?

    • AThe hook is running a full test suite before pushing.
    • BThe hook is sending notifications post-commit.
    • CThe hook is checking for commit message formats.
    • DThe hook is running ESLint on all files.
  4. 4.Why might a team use Husky for managing Git hooks?

    • ATo automatically execute hooks on the server.
    • BTo ensure hooks are committed in the .git directory.
    • CTo version and distribute hooks across the team.
    • DTo allow hooks to run without a shebang line.
  5. 5.A developer claims that server-side hooks can be used to reject pushes based on commit message format. What is the flaw in this statement?

    • AServer-side hooks cannot reject pushes.
    • BServer-side hooks are only for client-side operations.
    • CServer-side hooks are not designed to enforce commit message formats.
    • DServer-side hooks only run after accepting a push.
  6. 6.Which hook would you use to enforce a specific commit message format?

    • Acommit-msg
    • Bpre-commit
    • Cpre-push
    • Dpost-commit
  7. 7.What is the primary purpose of a pre-receive server-side hook?

    • ATo format code before committing.
    • BTo block pushes that don't meet team standards.
    • CTo run tests before pushing code.
    • DTo notify developers of new commits.