Last active
January 14, 2021 14:18
-
-
Save rawnly/71b6e53d4144e0515f19efa59837051e to your computer and use it in GitHub Desktop.
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
# Usage: commit <message> [-a|--add] [-p|--push] | |
# Example: commit "my first commit" -a -p | |
# GIT Equivalent: | |
# - git add -A . | |
# - git commit -a -m "NEXT-<*>: my first commit" | |
# - git push | |
function commit { | |
if [ -z $1 ]; then | |
echo "No commit message"; | |
return 0; | |
fi; | |
branch=$(git branch | grep '*' | grep -Eo 'NEXT-[0-9]+'); | |
if [ -z "$branch" ]; then | |
echo "WARN! Not a NEXT branch"; | |
else | |
branch="${branch}:"; | |
fi; | |
if [ "$2" = "--add" ] || [ "$2" = "-a" ]; then | |
git add -A . | |
fi; | |
git commit -a -m "${branch} $1"; | |
if [ "$3" = "--push" ] || [ "$3" = "-p" ]; then | |
git push; | |
fi; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment