0
0
Gitdevops~5 mins

Client-side vs server-side hooks in Git - Quick Revision & Key Differences

Choose your learning style9 modes available
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?
AOn your local computer
BOn the Git server
CIn the cloud
DIn the browser
Which hook can reject a push on the server?
Apre-commit
Bpost-commit
Cpost-checkout
Dpre-receive
What is a common use of a client-side pre-commit hook?
ASend email notifications
BRun tests before commit
CDeploy code to production
DBackup the repository
Which hook type helps enforce rules for all users pushing to a repository?
AServer-side hooks
BClient-side hooks
CLocal hooks
DPost-commit hooks
When does a server-side post-receive hook run?
ABefore a commit is made locally
BBefore a push is sent
CAfter a push is accepted on the server
DWhen cloning a repository
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.