Skip to content

Instantly share code, notes, and snippets.

View Unixeno's full-sized avatar
👨‍💻

unixeno Unixeno

👨‍💻
View GitHub Profile
@Unixeno
Unixeno / pre-push
Created January 3, 2020 15:38 — forked from StuPig/pre-push
禁止直接向master和develop分之提交代码的钩子,放在.git/hooks/pre-push
#!/bin/bash
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ "$current_branch" = "master" ] || [ "$current_branch" = "develop" ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo ""
echo "禁止直接向master或develop分支提交代码!"
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
exit 1