The script will parse your branch name to find the JIRA ticket number so you don't have to type it after each commit. It assumes the following structure: ticket-type/ticket-number
branchname -> captured
feature/MEC-1984
-> MEC-1984
bugfix/MEC-1984/v2
-> MEC-1984
feature/NO-JIRA
-> NO-JIRA
master
-> master
in summation, if you are on branch feature/RNTM-678
and you run the following after staging:
commit 'this is my commit message'
the commit message that will be logged will be:
[RNTM-678] this is my commit message
It also logs the last ten commits for your convenience.
$ git clone https://github.com/sjafri5/commit_script.git
$ cd commit_script
$ echo "export PATH=\$PATH:`pwd`" >> ~/.bash_profile
$ chmod 711 commit.sh
- add the following line to your
~/.bash_profile
:
alias commit='commit.sh'
# (you can substitute `commit` to whatever alias you want to type on the cli)
$ . ~/.bash_profile