Skip to content

Instantly share code, notes, and snippets.

@baldwindavid
Created October 26, 2025 18:43
Show Gist options
  • Save baldwindavid/826768b3dbe976f071068bc1612c55cb to your computer and use it in GitHub Desktop.
Save baldwindavid/826768b3dbe976f071068bc1612c55cb to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
# Usage: git_blame_viewer.sh <file> [line]
# Shows git blame for the file, optionally jumping to a specific line
file="${1:-}"
line="${2:-}"
if [[ -z "$file" ]]; then
echo "Error: No file provided"
exit 1
fi
if [[ ! -f "$file" ]]; then
echo "Error: File not found: $file"
exit 1
fi
# Run git blame through delta
# Delta handles paging and formatting automatically
git blame "$file" | delta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment