ogbofjnr
ogbofjnr

Reputation: 2038

How to update global git hooks for the repo?

When I update global git hooks, and make git init in repo hooks don't get updated. How to update them?

Upvotes: 0

Views: 863

Answers (3)

shafeeq
shafeeq

Reputation: 1599

When you do the first git init from your local repo, the git will copy the global hooks into the .git/hooks directory of the git repo you are working only if it's not there.

Solution is, delete the hook from .git/hooks directory of your local repository.

Upvotes: 0

ogbofjnr
ogbofjnr

Reputation: 2038

Turned out according to docs subsequent init in repo only add new files from template dir, but don’t update existing.

Upvotes: 0

Maroun
Maroun

Reputation: 96016

You need to run:

git config --global init.templatedir 'hooks_location'

Upvotes: 2

Related Questions