#!/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
