Skip to content

Commit

Permalink
feat: add gdc git diff choose script
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Sep 12, 2024
1 parent 79840ea commit 202e2bf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions modules/scripts/gdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

# This script lists all files that have been modified in the current git diff
# and allows you to choose one to view the diff of.

# Exit on error
set -e

FILES=$(git diff --stat | head -n-1 | cut -d' ' -f2)

choose() {
FILE=$(echo "$FILES" | gum choose)

if [ -z "$FILE" ]; then
echo "No file selected"
exit 1
fi

git diff -- "$FILE"
}

while true; do
choose
done

0 comments on commit 202e2bf

Please sign in to comment.