@@ -12,3 +12,50 @@ function lhs_git_scan_secrets() {
1212 echo " \033[31m Scan recursive \033[0m"
1313 docker run --rm -v $( pwd) :/repository:ro ${image_name} git secrets --scan -r /repository
1414}
15+
16+ function lhs_git_commit_suggestions() {
17+
18+ # More instruction - https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/
19+ # - https://chiamakaikeanyi.dev/how-to-write-good-git-commit-messages/
20+ # Set default git commit message - https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
21+ cat << -__EOF__
22+ git commit -m "[Add] - Your add description"
23+ git commit -m "[Update] - Your update description"
24+ git commit -m "[Remove] - remove somethings such as functions, temp file, ..."
25+ git commit -m "[Feat] – a new feature is introduced with the changes"
26+ git commit -m "[Fix] - a bug fix has occurred"
27+ git commit -m "[Chore] – for updating dependencies"
28+ git commit -m "[Refactor] - refactored code that neither fixes a bug nor adds a feature"
29+ git commit -m "[Docs] - updates to documentation such as a the README or other markdown files"
30+ git commit -m "[Style] - related to code formatting such as white-space, missing semi-colons, and so on"
31+ git commit -m "[Test] - including new or correcting previous tests"
32+ git commit -m "[Perf] – performance improvements"
33+ git commit -m "[CiCd] - continuous integration and continuous delivery related"
34+ git commit -m "[Build] – changes that affect the build system or external dependencies"
35+ git commit -m "[Revert] - reverts a previous commit"
36+ git commit -m "[Release] - Your Release description (Comment for the PR)"
37+
38+ + Example(You have to add git commit -m "" manually):
39+ Ex: git commit -m "[Feat] - improve performance with lazy load implementation for images"
40+ Ex: git commit -m "[Chore] - update npm dependency to latest version"
41+ Ex: git commit -m "[Fix] - bug preventing users from submitting the subscribe form"
42+ Ex: git commit -m "[Update] - incorrect client phone number within footer body per client request"
43+ Ex: git commit -m "[Refactor] - to refactor function names"
44+ Ex: git commit -m "[Chore] - to fix typo"
45+
46+ __EOF__
47+ }
48+
49+ function lhs_git_commit_suggestions_with_hint() {
50+ local lhs_input=$(
51+ lhs_git_commit_suggestions | peco --query " $LBUFFER " --prompt " Git commit suggestions >"
52+ )
53+
54+ # To check it is example.
55+ if [[ $lhs_input = Ex:* ]]; then
56+ BUFFER=$( echo " ${lhs_input} " | awk -F " Ex:" ' {print $2}' )
57+ else
58+ BUFFER=${lhs_input}
59+ fi
60+ CURSOR=$# BUFFER
61+ }
0 commit comments