(git): Add script to diff a single file with all existing branches.

Created with help of ChatGPT.
This commit is contained in:
Stefan Gaiselmann 2025-09-19 11:40:47 +02:00
parent ab384ea810
commit c8f54de1f6

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# File to compare
FILE="$1"
if [[ -z "$FILE" ]]; then
echo "Usage: $0 <file>"
exit 1
fi
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo current: $CURRENT_BRANCH
for BRANCH in $(git for-each-ref --format='%(refname:short)' refs/heads/); do
if [[ "$BRANCH" == "$CURRENT_BRANCH" ]]; then
continue
fi
echo "=== Diff vs $BRANCH ==="
git diff "$BRANCH" -- "$FILE"
echo
done