Skip to content

Instantly share code, notes, and snippets.

@AdieOlami
Last active June 8, 2020 23:22
Show Gist options
  • Save AdieOlami/878ea92156ec6df55f58e83d36ee198f to your computer and use it in GitHub Desktop.
Save AdieOlami/878ea92156ec6df55f58e83d36ee198f to your computer and use it in GitHub Desktop.
A simple Makefile to handle Git actions
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 \
@AdieOlami
Copy link
Author

USAGE: make git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment