Skip to content

Instantly share code, notes, and snippets.

@droidchef
Created June 2, 2016 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save droidchef/7eb182ea00e5b60b7e1fabbc19cb63b5 to your computer and use it in GitHub Desktop.
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
#!/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