diff --git a/.local/bin/scripts/git-dife b/.local/bin/scripts/git-dife new file mode 100755 index 0000000..4f288a9 --- /dev/null +++ b/.local/bin/scripts/git-dife @@ -0,0 +1,8 @@ +#!/bin/sh +# Diff untracked file to a tracked version in another branch (default upstream) +file="$1" +test -e "$file" && rooted=false || rooted=true +root="$($rooted && echo "$(git root)/")$file" +test ! -e "$root" && echo "No such file: $file" >&2 && exit 1 +upstream="${2:-@{u}}" +git show "$upstream:$($rooted || echo "./")$file" | dif --label "$1 $(stat "$1" --format '%y')" --label "$upstream" "$root" - diff --git a/.local/bin/scripts/rd b/.local/bin/scripts/rd index bd519ae..bc55e3e 100755 --- a/.local/bin/scripts/rd +++ b/.local/bin/scripts/rd @@ -8,9 +8,12 @@ do if test -e "$f/.git" || test -e "$f/packed-refs" then echo -n "Force delete git project $f? " read answer - test "$answer" = "y" && $elevate rm -rf "$f" + test "$answer" = "y" && + $elevate rm -rf "$f" else find "$f" -maxdepth 4 -empty -printf "Removing empty %p\n" -delete - test -e "$f" && echo -n "$f " >&2 && $elevate rm -rI "$f" + test -e "$f" && + echo -n "$f ($(ls -A $f | head -3 | paste -s -d' ')) " >&2 && + $elevate rm -rI "$f" fi else $elevate rm -i "$f" fi