From 83db83296a909ccbc2acc7d193083d066540f76d Mon Sep 17 00:00:00 2001 From: Mathew Payne <2772944+GeekMasher@users.noreply.github.com> Date: Tue, 28 Feb 2023 00:19:23 +0000 Subject: [PATCH] Add staged file check for commit example (#269) * Add staged file check for commit example * fix: stage all confirmation --------- Co-authored-by: Maas Lalani --- examples/commit.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/commit.sh b/examples/commit.sh index 21c1fc9..29ab94c 100755 --- a/examples/commit.sh +++ b/examples/commit.sh @@ -10,6 +10,10 @@ # # alias gcm='git commit -m "$(gum input)" -m "$(gum write)"' +if [ -z "$(git status -s -uno | grep -v '^ ' | awk '{print $2}')" ]; then + gum confirm "Stage all?" && git add . +fi + TYPE=$(gum choose "fix" "feat" "docs" "style" "refactor" "test" "chore" "revert") SCOPE=$(gum input --placeholder "scope")