Last active
December 1, 2015 17:28
-
-
Save caarlos0/4501ae18631597abb9a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# name: old-files.sh | |
# author: Carlos Alexandro Becker (caarlos0@gmail.com) | |
# | |
# List the files not changed in a git repo in the last X time. | |
# | |
# Usage: | |
# ./old-files.sh 1 year | |
# | |
set -eo pipefail | |
dir="$(mktemp -d)" | |
git log \ | |
--pretty="format:" \ | |
--since="$* ago" \ | |
--name-only | sort | uniq > "$dir/recently_changed" | |
git log \ | |
--pretty="format:" \ | |
--name-only | sort | uniq > "$dir/all" | |
for file in $(diff "$dir/recently_changed" "$dir/all" | cut -f2 -d' '); do | |
[ -f "$file" ] && echo $file | |
done | sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment