1.

What is git hooks?

Answer»

Sometimes there is a NEED to enforce policies, ensure consistency, and control your environment, and even handle deployment tasks. Git hooks are a basic idea that was ACTUALIZED to address a need. When creating programming on a common undertaking, keeping up style direct norms, or while conveying programming (all are circumstances that git is regularly included with), there are frequently dull errands that you will need to do each time an activity is taken. Git SNARES are occasion based. When you run certain git directions, the product will check the hooks catalogue inside the git store to check whether there is related content to run. Git hooks are run locally.

Some example hook scripts include:

  • pre-commit: Check the commit message for spelling errors.
  • pre-receive: Enforce project coding standards.
  • post-commit: Email/SMS team members of a NEW commit.
  • post-receive: Push the code to production.

Every Git repository has a .git/hooks folder with a script for each hook you can bind to. You're free to change or update these scripts as NECESSARY, and Git will execute them when those events occur.

Git hooks are divided into two categories:

  • Client-Side Hooks: Hooks that are called and executed on the committer's computer.
  • Server-Side Hooks: These hooks are executed on servers that are used to receive pushes.


Discussion

No Comment Found