O'Reilly logo

Git Best Practices Guide by Eric Pidoux

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 or merge 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required