-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit.sh
More file actions
executable file
·46 lines (40 loc) · 1.08 KB
/
commit.sh
File metadata and controls
executable file
·46 lines (40 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Get the current branch name
BRANCH_NAME=$(git branch --show-current)
# Define commit types
echo "Select commit type:"
options=("✨ Added" "🐛 Fixed" "🔧 Updated" "♻️ Changed" "🗑 Removed")
select opt in "${options[@]}"
do
case $opt in
"✨ Added")
COMMIT_TYPE="✨ Added:"
break
;;
"🐛 Fixed")
COMMIT_TYPE="🐛 Fixed:"
break
;;
"🔧 Updated")
COMMIT_TYPE="🔧 Updated:"
break
;;
"♻️ Changed")
COMMIT_TYPE="♻️ Changed:"
break
;;
"🗑 Removed")
COMMIT_TYPE="🗑 Removed:"
break
;;
*)
echo "Invalid option, please choose again."
;;
esac
done
# Get commit message
read -p "Enter commit message: " COMMIT_MSG
# Construct the commit message with branch name at the end
FINAL_COMMIT_MSG="$COMMIT_TYPE $COMMIT_MSG [$BRANCH_NAME]"
# Run git commit with formatted message
git commit -m "$FINAL_COMMIT_MSG"