Created
February 5, 2022 11:34
-
-
Save hasanisaeed/b0e26810dd5003a292a58eefc8a03beb to your computer and use it in GitHub Desktop.
Custom Git Commit
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/bash | |
# Colors | |
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
WHITE='\033[0;m' | |
echo "$RED***** Design by ™Saeed ツ -V0.0.1 *****$WHITE" | |
helpFunction() { | |
echo "***** USAGE *****" | |
echo "$0 -a add -m '<your message>'" | |
echo "-m Message could not to be empty." | |
exit 1 | |
} | |
while getopts "a:m:" opt; do | |
case "$opt" in | |
a) add="$OPTARG" ;; | |
m) message="$OPTARG" ;; | |
?) helpFunction ;; | |
esac | |
done | |
if [ -z "$add" ]; then | |
add="." | |
fi | |
if [ -z "$message" ]; then | |
echo "$RED >> Oops! Message is empty!$WHITE" | |
helpFunction | |
fi | |
git add "$add" | |
echo "$GREEN ◼◼◼◼◼ Files Added. ◼◼◼◼◼$WHITE" | |
git commit -m "$message" | |
echo "$GREEN ◼◼◼◼◼ Commit Done. ◼◼◼◼◼$WHITE" | |
git push | |
echo "$GREEN ◼◼◼◼◼ Successfully pushed. ◼◼◼◼◼$WHITE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment