-
-
Save jiito/fa7d88820df4dea2b2ee12570f61b14a to your computer and use it in GitHub Desktop.
Git Commit Linear Id Prefix (zsh)
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
# GET LINEAR ID | |
setopt local_options BASH_REMATCH | |
REGEX="[A-Za-z]+-[0-9]+" | |
BRANCH=$(git branch --show-current) | |
if [[ $BRANCH =~ $REGEX ]]; then | |
PREFIX=$BASH_REMATCH[1] | |
fi | |
# COMMIT CHANGES WITH PREFIX | |
MESSAGE="$1" | |
if [[ ! -z "$PREFIX" ]]; then | |
MESSAGE="[$PREFIX]: "$MESSAGE | |
fi | |
git commit -S -m "$MESSAGE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment