tarmolov / git-hooks-js

A tool to manage and run project git hooks
167 stars 30 forks source link

use $GIT_DIR to store the hooks #23

Closed tunnckoCore closed 7 years ago

tunnckoCore commented 8 years ago

Why use .githooks in project root? Why not $GIT_DIR/templates/hooks/* or $GIT_DIR/.githooksjs/*?

It's always better to follow conventions and structures.

tarmolov commented 8 years ago

The benefits of .githooks in the project root are following:

  1. You have git history for hooks too. Simple to maintain.
  2. Push changed hooks and all collaborators receive the update. Simple to share updated hook with a team.

It sounds ok to follow conventions and use GIT_WORK_TREE env variable, for example. To be honest I cannot imagine a case when it will be useful.

Could you share when using git env variables can save the day?