text 在git commit消息前面的JIRA ID。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 在git commit消息前面的JIRA ID。相关的知识,希望对你有一定的参考价值。

#!/bin/bash
  2 # Include any branches for which you wish to disable this script
  3 if [ -z "$BRANCHES_TO_SKIP" ]; then
  4   BRANCHES_TO_SKIP=(master develop test)
  5 fi
  6
  7 BRANCH_NAME=$(git symbolic-ref --short HEAD | grep -o '[A-Z]\+-[0-9]\+')
  8 BRANCH_NAME="${BRANCH_NAME##*/}"
  9
 10 BRANCH_EXCLUDED=$(printf "%s\n" "${BRANCHES_TO_SKIP[@]}" | grep -c "^$BRANCH_NAME$")
 11 BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1)
 12
 13 if [ -n "$BRANCH_NAME" ] && ! [[ $BRANCH_EXCLUDED -eq 1 ]] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then
 14   gsed -i.bak -e "1s/^/$BRANCH_NAME: /" $1
 15 fi
~

以上是关于text 在git commit消息前面的JIRA ID。的主要内容,如果未能解决你的问题,请参考以下文章

git commit 在一行中打印出消息

在 Git 钩子中获取提交消息

git删除指定commit

text 列出git commit中的所有文件

text git-commitのチェック#memo #git

text Git Commit Messages结构