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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top