背景:
小組規(guī)定,如果git commit 是 fixed bug, 則要求與 JIRA 上的 bugNumber 綁定,方便 QA 同學(xué) review 相關(guān) changed code,由此要求commit 的 message的格式如下:OUR_PROJECTNAME-bugNumber # real commit message
這樣的話,每次 commit 的時候很繁瑣,所以就考慮簡化一下,寫了個 alias:
alias gcbug='function __send_commit_msg(){msg_str="OUR_PROJECTNAME-$1 # $2"; git commit -m "$msg_str" ;};__send_commit_msg'
Attention: 范例所涉及 shell 為 zsh, 用bash 的同學(xué)請自行修改;
eg: gcbug 110 "fixed ui issue"