bin/git-dife: allow diffing untracked files tracked remotely
This commit is contained in:
parent
3c34126214
commit
02c959ce70
|
@ -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" -
|
|
@ -8,9 +8,12 @@ do
|
||||||
if test -e "$f/.git" || test -e "$f/packed-refs"
|
if test -e "$f/.git" || test -e "$f/packed-refs"
|
||||||
then echo -n "Force delete git project $f? "
|
then echo -n "Force delete git project $f? "
|
||||||
read answer
|
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
|
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
|
fi
|
||||||
else $elevate rm -i "$f"
|
else $elevate rm -i "$f"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue