Skip to content

Instantly share code, notes, and snippets.

@nathanpc
Created March 17, 2025 12:52
Show Gist options
  • Save nathanpc/dbe6e50b40708d01432e48e65a5001f3 to your computer and use it in GitHub Desktop.
Save nathanpc/dbe6e50b40708d01432e48e65a5001f3 to your computer and use it in GitHub Desktop.
Creates a LaTeX difference project from a repository and 2 separate commits
#!/bin/bash
# Settings
repourl="[email protected]:nathanpc/paper-iot-framework.git"
sha1_old="da7d715db0df634a8fa7d403661df0c649d5bd42"
sha1_new="97e926cdbc28a3765754eb96d65be0b39f572e7c"
# Clone and duplicate repositories.
echo "Cloning repository..."
git clone "$repourl" old
cp -r old new
echo "Resetting old repository..."
pushd old
git reset --hard $sha1_old
popd
echo "Resetting new repository..."
pushd new
git reset --hard $sha1_new
popd
# Make diff
echo "Building difference document..."
cp -r new diff
find diff -type f -iname '*.tex' | sed 's/^diff\///g' | perl -ne 'chomp; system("latexdiff \"old/$_\" \"new/$_\" > \"diff/$_\"");'
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment