-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit.sh
More file actions
executable file
·44 lines (39 loc) · 892 Bytes
/
Copy pathcommit.sh
File metadata and controls
executable file
·44 lines (39 loc) · 892 Bytes
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
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
current_branch=$(git rev-parse --abbrev-ref HEAD)
# Prevent pushing to main or master branch
if [ "$current_branch" == "main" ]; then
echo "\n${RED}Stop trying to push to the main branch, Rachel!${NC}\n"
exit 1
fi
# Check if an argument is passed
if [ -z "$1" ]; then
echo "${RED}Please provide a commit message or shortcut!${NC}"
exit 1
fi
# Set commit message based on the argument
case "$1" in
fmc)
message="merges in new main branch and fixes merge conflict"
;;
ff)
message="removes feature flags"
;;
db)
rails db:migrate:with_data
git add db/
message="fixes database merge conflict"
;;
r)
message="fixes for rubocop or eslint"
;;
s)
message="stores changes to do stuff on another branch"
;;
*)
message="$1"
;;
esac
git commit -m "$message"
git push