commit=$(git log --max-count=1 --pretty="format:%s")
echo $commit
echo "git commit checkings"
isFeat=$(echo $commit | grep '^feat: \B#[a-zA-Z]\{2,6\}-[1-9]\d*')
isFix=$(echo $commit | grep '^fix: \B#[a-zA-Z]\{2,6\}-[1-9]\d*')
isPerf=$(echo $commit | grep '^perf: \B#[a-zA-Z]\{2,6\}-[1-9]\d*')
isRevert=$(echo $commit | grep 'revert')
isTag=$(echo $commit | grep '[0-9]\.[0-9]\.[0-9]')
isMerge=$(echo $commit | grep 'Merge branch')
if [ -n "$isFeat" ] || [ -n "$isFix" ] || [ -n "$isPerf" ] || [ -n "$isRevert" ] || [ -n "$isTag" ] || [ -n "$isMerge" ]; then
  echo "git commit checking succ! \n"
  exit
fi

echo "git commit checking fail! \nreason: git commit rule:  [type]:[空格]#[taskId][空格][描述] \ncommit type enum: [feat, fix, perf, revert] \n"
exit 1
