Eru Ilúvatar 919f34db7e
feat: fix script utils - closes #9 (#10)
Signed-off-by: Arthurim <arthurbdauphine@gmail.com>

Signed-off-by: Arthurim <arthurbdauphine@gmail.com>
2022-12-20 15:04:57 +00:00

11 lines
427 B
Bash

#!/bin/sh
# bash script to commit in accordance with the branch name
# usage: ./scripts/commit.sh
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
branch="${branch##*feat/}"
branch="${branch//\_/ }"
issue_number="${branch//issue\-/}"
title=$( cut -d ' ' -f 2- <<< "$issue_number" )
issue_number=$( cut -d ' ' -f 1 <<< "$issue_number" )
commit_message="feat: $title - closes #$issue_number"
git commit -sam "$commit_message"