Git hooks
Git has a way to execute scripts when a Git command is performed. It will help you to perform some automated actions while you or one of your team members executes a Git command. The uses of these scripts are unlimited and very easy to set up. It will be very helpful to get notifications, format code, deploy websites, perform tasks on folders, and so on.
There are two types of hooks, depending on the commands:
- Client hooks: These kinds of hooks are for client operations, such as the
commit
ormerge
command - Server hooks: These hooks are for Git server-side operations, such as the
push
command
Client hooks
There are many types of hooks for the client side; we choose to present the two most-known kinds. The first hook, pre-commit
, works with ...
Get Git Best Practices Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.