Last active
June 8, 2020 23:22
-
-
Save AdieOlami/878ea92156ec6df55f58e83d36ee198f to your computer and use it in GitHub Desktop.
A simple Makefile to handle Git actions
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
git: git_checkout_branch | |
echo "πππ DONE!!! Enjoy from @AdieOlami" | |
show_dir: | |
@echo "*****************************************************************"; \ | |
echo "\nYour current working directory is \nπ‘" `pwd`; \ | |
echo "\n*****************************************************************"; | |
git_checkout_branch: show_dir | |
@read -p "π Do you want to create a new Branch y/n: " -n 1 -r; \ | |
if [[ $$REPLY =~ ^[Yy] ]]; then \ | |
echo "\n*****************************************************************"; \ | |
echo "\n\nπ― You can ignore adding underscore, that would be handled automatically"; \ | |
echo "\n*****************************************************************"; \ | |
echo "\nπ» Feature Branch Name?: "; \ | |
read BRANCH; \ | |
echo "π€ Creating your BRANCH"; \ | |
BRANCH=$${BRANCH// /_}; \ | |
echo π¦ $$BRANCH; \ | |
git checkout -b "$$BRANCH"; \ | |
echo "β BRANCH created successfully"; \ | |
make git_add_commit; \ | |
elif [[ $$REPLY =~ ^[Nn] ]]; then \ | |
make git_add_commit; \ | |
else \ | |
echo "\nπ exited successfully"; \ | |
fi | |
git_add_commit: | |
@echo "\nβοΈ DISCLAIMER: you are about to commit in your current branch"; \ | |
read -p "π Do you want to commit to this branch? y/n: " -n 1 -r; \ | |
if [[ $$REPLY =~ ^[Yy] ]]; then \ | |
echo "\nβ You just said yes, Yay! \n"; \ | |
read -p "π Enter your commit message: " MESSAGE; \ | |
git add . && git commit -m "$$MESSAGE"; \ | |
echo "\nβ Just Commited with Message" $$MESSAGE; \ | |
else \ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
USAGE:
make git