commit.sh
This file
Path
examples/commit.sh
28 lines · 1.1 KiB · Shell
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 6837ed2 point at it.
feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2
lines 1–28why, one step back1#!/bin/sh23# This script is used to write a conventional commit message.4# It prompts the user to choose the type of commit as specified in the5# conventional commit spec. And then prompts for the summary and detailed6# description of the message and uses the values provided. as the summary and7# details of the message.8#9# If you want to add a simpler version of this script to your dotfiles, use:10#11# alias gcm='git commit -m "$(gum input)" -m "$(gum write)"'1213# if [ -z "$(git status -s -uno | grep -v '^ ' | awk '{print $2}')" ]; then14# gum confirm "Stage all?" && git add .15# fi1617TYPE=$(gum choose "fix" "feat" "docs" "style" "refactor" "test" "chore" "revert")18SCOPE=$(gum input --placeholder "scope")1920# Since the scope is optional, wrap it in parentheses if it has a value.21test -n "$SCOPE" && SCOPE="($SCOPE)"2223# Pre-populate the input with the type(scope): so that the user may change it24SUMMARY=$(gum input --value "$TYPE$SCOPE: " --placeholder "Summary of this change")25DESCRIPTION=$(gum write --placeholder "Details of this change")2627# Commit these changes if user confirms28gum confirm "Commit changes?" && git commit -m "$SUMMARY" -m "$DESCRIPTION"