-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add gdc git diff choose script
- Loading branch information
1 parent
79840ea
commit 202e2bf
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |