Question

If I have a local repository pulled from a remote one, and I add git hooks to my local repository before I push it back to the remote one, do the hooks go to the remote repo with the code?

Was it helpful?

Solution

Nope. Nothing that you add directly under the .git directory will be sent from clone to clone, including hooks. It's a little inconvenient sometimes, but it also means that you can easily have different hooks in different clones, so it's a tradeoff.

One strategy is to put your hook scripts in a directory that is tracked by git, and write a script that symlinks them in to .git, so developers can easily wire them up in a fresh clone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top