Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass git hook script to remote repository and to my team mates

I am team of 4 members, we have have git repo in azure devOps, I am given task to add git hook(scan code for indentation, unwanted spaces etc). I know git hook must be added to ./.git/hooks, I have scripts ready. But how do I ensure my other teammates receive my script in their local repo, so code check is done before they commit new files.

FYI, any changes made .git will remain only to local repo, but what is the easiest way that my git hook is passed onto all my team members?

like image 630
karthik_personal Avatar asked Oct 27 '25 10:10

karthik_personal


1 Answers

The problem with such a hook is that it is a client-side hook, which involves a deployment to all user.
This differs from a server-side hook, which is modified once, and applied for every user git push to said server.

In my case, I ask my users to make a symlink from their .git/hooks/pre-commit file to a file managed in the repository.
That way, updating that file is easy and applied automatically.

like image 142
VonC Avatar answered Oct 30 '25 02:10

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!