Коммиты в мастер
Nov. 11th, 2023 10:45 amПушить нельзя, а коммитить локально можно. В очередной раз промахнувшись бранчем и вынужденный делать git branch -D master, я набрался attention span и сделал прекоммит хук, чтобы такое запретить: .git/hooks/pre-commit:
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "master" ]; then
echo "Direct commits to master branch are not allowed."
exit 1
fi
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "master" ]; then
echo "Direct commits to master branch are not allowed."
exit 1
fi