From d20838fb69f2dfb5151af62934ce12b038b87396 Mon Sep 17 00:00:00 2001 From: Eshan Roy <148610067+eshanized@users.noreply.github.com> Date: Wed, 6 Nov 2024 19:10:34 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20refactor(n/a):=20add=20push=20sc?= =?UTF-8?q?ript?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- push.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 push.sh diff --git a/push.sh b/push.sh new file mode 100755 index 00000000..27c30dd9 --- /dev/null +++ b/push.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Author : ESHAN ROY +# Author URI : https://eshanized.github.io + +# NOTE : Run at your own Risk! + +# Define the conventional commit types with emojis +TYPES=("๐ŸŽ‰ feat" "๐Ÿž fix" "๐Ÿ“š docs" "๐Ÿ’… style" "๐Ÿ”จ refactor" "โšก๏ธ perf" "๐Ÿงช test" "๐Ÿ› ๏ธ build" "๐Ÿค– ci" "๐Ÿงน chore" "โช๏ธ revert") + +# Prompt the user to select a commit type +echo "Select a commit type:" +select type in "${TYPES[@]}"; do + break +done + +# Extract the commit type and emoji from the selection +type_emoji=${type} +type=${type_emoji#* } +emoji=${type_emoji% *} + +# Prompt the user to enter a scope (optional) +read -p "Enter a scope (optional): " scope + +# Prompt the user to enter a short description +read -p "Enter a short description: " desc + +# Prompt the user to enter a longer description (optional) +read -p "Enter a longer description (optional): " long_desc + +# Create the commit message +commit_msg="$emoji $type($scope): $desc" + +# If a longer description was provided, add it to the commit message +if [ -n "$long_desc" ]; then + commit_msg+=" + +$long_desc" +fi + +# Print the commit message to the console +echo "Commit message:" +echo "$commit_msg" + +# Stage all changes +git add . + +# Commit the changes with the conventional commit message +git commit -m "$commit_msg" + +# Push the changes to the remote repository +git push origin $(git rev-parse --abbrev-ref HEAD)