-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitcommit.sh
More file actions
executable file
·71 lines (63 loc) · 1.57 KB
/
gitcommit.sh
File metadata and controls
executable file
·71 lines (63 loc) · 1.57 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/env bash
files=$1
if [[ -n $files ]]; then
git add $files
echo "Added file(s) $1"
fi
echo ""
printf "What's the commit type ?\n ➛ feat: new feature for the user\n ➛ fix: bug fix for the user\n ➛ docs: changes to the documentation\n ➛ style: formatting, missing semi colons, etc; no production code change\n ➛ refactor: refactoring production code, eg. \
renaming a variable, func, file etc\n ➛ test: adding missing tests, refactoring tests\n ➛ chore: updates on task/codes\n \n"
select type in feat fix docs style refactor test chore
do
case $type in
feat|fix|docs|style|refactor|test|chore)
break
;;
*)
echo "Invalid type"
;;
esac
done
clear
echo "$type"
printf "What's the scope ?\n\t"
read input
scope=${input:-$scope}
clear
if [[ -z $scope ]]; then
echo "$type"
commsg="$type"
else
echo "$type[$scope]"
commsg="$type[$scope]"
fi
printf "What exactly happened 🤔 ?\n\t"
read input
message=${input:-$message}
clear
printf "Your commit message📨:\n$commsg: $message\n"
printf "Create Commit ?:\n y(Yes) n(Abort) r(Start Over) :\n"
read input
decide=${input}
if [ $decide == 'y' ]; then
git commit -m "$commsg: $message"
elif [ $decide == 'r' ]; then
clear
echo "Restarting ..."
/home/imitor/Documents/git_repos/ids/git_commit.sh
elif [ $decide == 'n' ]; then
exit
else
echo "Invalid choice"
exit
fi
printf "Wanna Push ?:\n y(Yes) n(No):\n"
read push
push_decide=${push}
if [ $push_decide == 'y' ]; then
clear
git push
else
clear
exit
fi