Symbolic link to a hook in git Symbolic link to a hook in git git git

Symbolic link to a hook in git


you just used wrong path, it should be:

ln -s -f ../../hooks/post-merge .git/hooks/post-merge


While you can use symbolic links, you can also change the hooks folder for your project in your git settings with :

git config core.hooksPath hooks/

Which is local by default so it won't ruin git hooks for your other projects. It works for all hook in this repository, so it's especially useful if you have more than one hook.

If you already have custom hooks in .git/hooks/ that you do not want to share with your team you can add them in hooks/ and add a .gitignore so they're not shared.


Changing directory before linking

cd /path/to/project-repo/.git/hooksln -s -f ../../hooks/post-merge ./post-merge