Skip to content

Commit

Permalink
feat: update prepare commit message script
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Jul 31, 2023
1 parent 677f2e9 commit c2071e3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bin/bin/prepare-commit-msg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ fi
# shellcheck disable=2016
printf '%s' '
#!/bin/sh
ORIG_MSG_FILE="$1" # Grab the current template
TEMP=$(mktemp /tmp/git-msg-XXXXX) # Create a temp file
trap "rm -f $TEMP" exit # Remove temp file on exit
MSG=$(git log -5 --pretty=%s) # Grab the first line of the last commit message
ORIG_MSG_FILE="$1"
TEMP=$(mktemp /tmp/git-msg-XXXXX)
trap "rm -f $TEMP" exit
(
printf "\n\n# Last Commit: %s \n\n" "$MSG"
printf "# ---------- \n"
git log -5 --pretty=%s | xargs -I{} printf "# %s\n" {}
printf "# ---------- \n"
cat "$ORIG_MSG_FILE"
) >"$TEMP" # print all to temp file
cat "$TEMP" >"$ORIG_MSG_FILE" # Move temp file to commit message
Expand Down

0 comments on commit c2071e3

Please sign in to comment.