有什么方法可以阻止删除远程分支?
我想阻止删除远程分支,但是正常的流程(例如代码检查和签出)应该可以正常工作!
不使用乙醇钠!是否可以 ?
请帮忙 !
对的,这是可能的。只需添加合适的服务器端git钩子即可。
例:
#create repositories
git init a
git init --bare b
#add the hook in "b"
echo -e '#!/usr/bin/bash\nread old new ref\ntest $new != 0000000000000000000000000000000000000000' >>b/hooks/pre-receive
chmod +x b/hooks/pre-receive
#create a commit in "a"
cd a
echo foo >test
git add .
git commit -m testcommit
#push it to "b"
git push ../b master
#try to delete remote branch
git push ../b :master
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句