change default git hooks

前端 未结 4 2275
温柔的废话
温柔的废话 2020-11-28 05:52

Not sure if this is possible in git (I haven\'t found it but I may be using the wrong vocabulary in my searches), but it be would useful to be able to modify and enable hook

4条回答
  •  佛祖请我去吃肉
    2020-11-28 06:34

    From the git-init man page (also works with git-clone if you are cloning an existing repo instead of creating a new one from scratch):

           --template=
               Provide the directory from which templates will be used. The
               default template directory is /usr/share/git-core/templates.
    
               When specified,  is used as the source of the
               template files rather than the default. The template files include
               some directory structure, some suggested "exclude patterns", and
               copies of non-executing "hook" files. The suggested patterns and
               hook files are all modifiable and extensible.
    

    You can modify the system-wide template directory (which defaults to /usr/share/git-core/templates, but may be in a different location on your machine), you can supply --template= on the command line when you create or clone the repo, or you can configure the default template directory in your config file:

    [init]
         templatedir = /path/to/templates
    

提交回复
热议问题