Recall & Review
beginner
What is a client-side hook in Git?
A client-side hook is a script that runs on your local computer before or after certain Git actions, like committing or merging. It helps you check or change things before sending changes to the server.
Click to reveal answer
beginner
What is a server-side hook in Git?
A server-side hook is a script that runs on the Git server when someone pushes changes. It can accept or reject changes, enforce rules, or trigger other actions on the server.
Click to reveal answer
intermediate
Name one example of a client-side hook and its purpose.
The
pre-commit hook runs before a commit is saved. It can check code style or run tests to prevent bad commits.Click to reveal answer
intermediate
Name one example of a server-side hook and its purpose.
The
pre-receive hook runs on the server before accepting pushed changes. It can reject pushes that don't meet rules, like missing tests or wrong branch.Click to reveal answer
beginner
What is a key difference between client-side and server-side hooks?
Client-side hooks run on your computer before you send changes. Server-side hooks run on the server after you push changes. Client-side hooks help you catch problems early; server-side hooks enforce rules for everyone.
Click to reveal answer
Where does a Git client-side hook run?
✗ Incorrect
Client-side hooks run on your local computer before or after Git actions like commits.
Which hook can reject a push on the server?
✗ Incorrect
The pre-receive hook runs on the server before accepting pushed changes and can reject them.
What is a common use of a client-side pre-commit hook?
✗ Incorrect
Pre-commit hooks often run tests or check code style before saving a commit.
Which hook type helps enforce rules for all users pushing to a repository?
✗ Incorrect
Server-side hooks run on the server and enforce rules for everyone pushing changes.
When does a server-side post-receive hook run?
✗ Incorrect
Post-receive hooks run on the server after a push is accepted to trigger actions like deployment.
Explain the difference between client-side and server-side Git hooks and give one example of each.
Think about where the hook runs and what it controls.
You got /4 concepts.
Describe a scenario where using a server-side hook is better than a client-side hook.
Consider control and security for a shared repository.
You got /4 concepts.