I wrote my own custom post-merge hook, now I added a "hooks" directory to my main project folder (since git doesn't track changes in .git/hooks), somewhere I read that I can make a symbolic link from hooks to .git/hooks so I don't have to copy the file from one folder to the other every time someone changes it so I tried:
我写我自己的自定义post-merge钩,现在我添加了一个“钩子”目录主要项目文件夹(因为git不跟踪更改. /钩),地方我读,我可以让一个符号链接从钩子. /钩子所以我没有将文件从一个文件夹复制到另一个每次有人所以我试着改变:
ln -s -f hooks/post-merge .git/hooks/post-merge
ln -s -f钩子/归并后。git/钩子/归并后
But it doesn't seem to work, any ideas why? "ln hooks/post-merge .git/hooks/post-merge" works fine but making a hard link is the same as copyin I guess....
但这似乎行不通,有什么办法吗?“ln钩/ post-merge . /钩/ post-merge”没问题,但做一个硬链接是一样的copyin我猜....
3 个解决方案
#1
128
you just used wrong path, it should be:
你用错了路径,应该是:
ln -s -f ../../hooks/post-merge .git/hooks/post-merge
#2
2
Changing directory before linking
改变目录链接之前
cd /path/to/project-repo/.git/hooks
ln -s -f ../../hooks/post-merge ./post-merge
#3
1
why not just cp ./hooks/* .git/hooks/
为什么不只是cp ./hook /* .git/hook / ?
this worked for my in mac os
这在我的mac操作系统中很有用。
#1
128
you just used wrong path, it should be:
你用错了路径,应该是:
ln -s -f ../../hooks/post-merge .git/hooks/post-merge
#2
2
Changing directory before linking
改变目录链接之前
cd /path/to/project-repo/.git/hooks
ln -s -f ../../hooks/post-merge ./post-merge
#3
1
why not just cp ./hooks/* .git/hooks/
为什么不只是cp ./hook /* .git/hook / ?
this worked for my in mac os
这在我的mac操作系统中很有用。