Skip to content

Instantly share code, notes, and snippets.

@amoblin
Created November 10, 2015 07:55
Show Gist options
  • Save amoblin/8e8f062c551cf4791b5f to your computer and use it in GitHub Desktop.
Save amoblin/8e8f062c551cf4791b5f to your computer and use it in GitHub Desktop.
提交信息带上产品线名称
#!/bin/sh
PRODUCT_NAME="巴士"
PRODUCT_NAME="${PRODUCT_NAME##*/}"
NAME_IN_COMMIT=$(grep -c "\[$PRODUCT_NAME\]" $1)
if [ -n "$PRODUCT_NAME" ] && ! [[ $NAME_IN_COMMIT -ge 1 ]]; then
sed -i.bak -e "1s/^/[$PRODUCT_NAME] /" $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment