Last active
December 13, 2024 19:42
-
-
Save dcommander/1977746e36b3a245e334291f4d74e034 to your computer and use it in GitHub Desktop.
Scripts that facilitate using Git to track changes to photo/video content without actually committing the content
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
git config filter.heicfilter.clean heicsig | |
git config filter.heicfilter.smudge cat | |
git config filter.heicfilter.required true | |
git config filter.imgfilter.clean imgsig | |
git config filter.imgfilter.smudge cat | |
git config filter.imgfilter.required true | |
git config filter.vidfilter.clean vidsig | |
git config filter.vidfilter.smudge cat | |
git config filter.vidfilter.required true | |
cat >.gitattributes <<EOF | |
*.HEIC filter=heicfilter | |
*.heic filter=heicfilter | |
*.JPG filter=imgfilter | |
*.jpg filter=imgfilter | |
*.png filter=imgfilter | |
*.THM filter=imgfilter | |
*.DNG filter=imgfilter | |
*.dng filter=imgfilter | |
*.AVI filter=vidfilter | |
*.avi filter=vidfilter | |
*.MP4 filter=vidfilter | |
*.mp4 filter=vidfilter | |
*.m4v filter=vidfilter | |
*.MOV filter=vidfilter | |
*.mov filter=vidfilter | |
*.psd filter=vidfilter | |
*.CR2 filter=vidfilter | |
*.CRW filter=vidfilter | |
*.mp3 filter=vidfilter | |
EOF |
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
set -u | |
set -e | |
trap onexit INT | |
trap onexit TERM | |
trap onexit EXIT | |
TMPFILE= | |
onexit() { | |
if [ ! "$TMPFILE" = "" ]; then | |
rm -f $TMPFILE | |
fi | |
} | |
TMPFILE=`mktemp -t imgsig` | |
IMAGEMAGICK_PATH=${HEICSIG_IMAGEMAGICK_PATH:-} | |
echo File checksum: `tee $TMPFILE | sha1sum | cut -f1 -d' '` | |
echo Image checksum: `${IMAGEMAGICK_PATH}magick $TMPFILE ppm:- | sha1sum | cut -f1 -d' '` | |
echo EXIF: | |
cat $TMPFILE | exiftool -n -x ExifToolVersion - | | |
LANG=C sed -E 's/^(Image\ Size +: )([0-9]+) ([0-9]+)(.*)$/\1\2x\3\4/g' |
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
set -u | |
set -e | |
trap onexit INT | |
trap onexit TERM | |
trap onexit EXIT | |
TMPFILE= | |
onexit() { | |
if [ ! "$TMPFILE" = "" ]; then | |
rm -f $TMPFILE | |
fi | |
} | |
TMPFILE=`mktemp -t imgsig` | |
IMAGEMAGICK_PATH=${IMGSIG_IMAGEMAGICK_PATH:-} | |
echo File checksum: `tee $TMPFILE | sha1sum | cut -f1 -d' '` | |
echo Image checksum: `${IMAGEMAGICK_PATH}convert $TMPFILE ppm:- | sha1sum | cut -f1 -d' '` | |
echo EXIF: | |
cat $TMPFILE | exiftool -n -x ExifToolVersion - | | |
LANG=C sed -E 's/^(Image\ Size +: )([0-9]+) ([0-9]+)(.*)$/\1\2x\3\4/g' |
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
set -u | |
set -e | |
trap onexit INT | |
trap onexit TERM | |
trap onexit EXIT | |
TMPFILE= | |
onexit() { | |
if [ ! "$TMPFILE" = "" ]; then | |
rm -f $TMPFILE | |
fi | |
} | |
TMPFILE=`mktemp -t imgsig` | |
echo File checksum: `tee $TMPFILE | sha1sum | cut -f1 -d' '` | |
echo EXIF: | |
cat $TMPFILE | exiftool -n -x ExifToolVersion -x Warning - | | |
sed -E 's/^(Image\ Size +: )([0-9]+) ([0-9]+)(.*)$/\1\2x\3\4/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment