Created
August 18, 2025 08:12
-
-
Save LukasWoodtli/4e97dab762888377a3efa33e5c14bf0a to your computer and use it in GitHub Desktop.
Check git history for changed files
This file contains hidden or 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
#!/usr/bin/env sh | |
set -u | |
set -e | |
to_rev=$1 | |
from_rev=$2 | |
revs=$(git rev-list "$to_rev".."$from_rev") | |
for rev in $revs | |
do | |
echo Checking commit: | |
git log -n1 --oneline "$rev" | |
if git diff-tree -r --diff-filter=M "${rev}^!" | awk '{ print $5 }' | grep -q M | |
then | |
echo File changed! | |
git diff --raw "${rev}^!" | |
exit 1 | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment