ambevar-dotfiles/.scripts/git-compare

20 lines
406 B
Bash
Executable File

#!/bin/sh
if [ $# -ne 1 ]; then
cat<<EOF
Usage: ${0##*/} FOLDER
Compare current git repo with FOLDER.
EOF
exit
fi
REPO="$(mktemp)"
FOLDER="$(mktemp)"
git ls-files | sort > "$REPO"
find "$1" -type f ! -path "*.git/*" | sed 's/^[^\/]*\///g' | sort > "$FOLDER"
rm -f "$REPO" "$FOLDER"
## Zsh version.
# comm -3 <(git ls-files | sort) <(find "$1" -type f ! -path "*.git/*" | sed 's/^[^\/]*\///g' | sort)