Created
July 3, 2018 11:40
-
-
Save BruceGitHub/cbc63c3e86c33613a0b80635cab04238 to your computer and use it in GitHub Desktop.
from name branch as XXXX-YYYYY extract string and will prompt "xxx-yy: ..." for commit message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BRANCHNAME=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/') | |
FLAT_COMMIT=$( echo $BRANCHNAME | tr -d '(' | tr -d ')' ) | |
IFS='-' read -r -a myarray <<< "$FLAT_COMMIT" | |
echo "Digita il messaggio di commit: puoi modificare anche il nome del branch " | |
INPUT_COMMIT=$(echo "${myarray[0]}"-"${myarray[1]}") | |
read -i "$INPUT_COMMIT: " -e answer | |
git commit -am "$answer" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment