読者です 読者をやめる 読者になる 読者になる

あいつの日誌β

あいつの日誌です。

proscribe to commit on master branch

% cat .git/hooks/commit-msg
#!/bin/bash
 
BRANCH=$(git symbolic-ref HEAD)
if [ "$BRANCH" == "refs/heads/master" ]; then
  echo -e "\033[31mcannot commit on master branch.\033[0m"
  echo -e "\033[31mplease commit on topic branch.\033[0m"
  exit 1
fi

grep 'PROJECTNAME-[0-9]\+$' $1
if [ $? -eq 0 ]; then
  exit
fi

echo -e "\033[31mcannot commit without tikect id!!\033[0m"
exit 1