Created
June 2, 2016 13:27
-
-
Save droidchef/7eb182ea00e5b60b7e1fabbc19cb63b5 to your computer and use it in GitHub Desktop.
save this file in your /bin which is in your path. So that you can use it from your command line as $commit feat
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
#!/bin/sh | |
TYPE=$1 | |
if [ "$TYPE" == "feat" ]; then | |
MESSAGE="a new feature" | |
elif [ "$TYPE" == "fix" ]; then | |
MESSAGE="a bug fix" | |
elif [ "$TYPE" == "docs" ]; then | |
MESSAGE="changes to documentation" | |
elif [ "$TYPE" == "style" ]; then | |
MESSAGE="formatting, missing semi colons, etc; no code change" | |
elif [ "$TYPE" == "refactor" ]; then | |
MESSAGE="refactoring production code" | |
elif [ "$TYPE" == "test" ]; then | |
MESSAGE="adding tests, refactoring test; no production code change" | |
elif [ "$TYPE" == "chore" ]; then | |
MESSAGE="updating build tasks, package manager configs, etc; no production code change" | |
else | |
MESSAGE="nothing" | |
fi | |
if [ "$MESSAGE" == "nothing" ]; then | |
echo "Invalid Commit Type. Must be one of (feat, fix, docs, style, refactor, test or chore)" | |
exit | |
else | |
echo "Committing $MESSAGE" | |
fi | |
echo "Enter a commit message:" | |
read commitmessage | |
git commit -m "$commitmessage" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment