pre-commit.hook installation fails with git worktree
When we are in a worktree, .git isn't a folder but a file containing the path to the original git repository. The custom command to copy the hook fails as it does not parse that file. The file format relatively simple:
gitdir: /absolute/path/to/repo