Last active
March 1, 2024 12:44
-
-
Save Zash/69bea1c814b503d6ac6f9865927f0d00 to your computer and use it in GitHub Desktop.
git-diff json
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
#!/bin/bash | |
set -euo pipefail | |
case $# in | |
1) | |
diff -u --color --label="$1 @ HEAD" --label="$1" <(git show "HEAD:$1" | yq4 -oj | gron) <(yq4 -oj "$1" | gron) | |
;; | |
2) | |
diff -u --color --label="$1 @ $2^" --label="$1 @ $2" <(git show "$2^:$1" | yq4 -oj | gron) <(git show "$2:$1" | yq4 -oj | gron) | |
;; | |
3) | |
diff -u --color --label="$1 @ $2" --label="$1 @ $3" <(git show "$2:$1" | yq4 -oj | gron) <(git show "${3}:$1" | yq4 -oj | gron) | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment